python - pip安装模块错误

标签 python python-3.x python-2.7 pip

大家好,我尝试使用 pip install gmpy2 安装一个名为 gmpy2 的 python 模块,但在 wheel 构建过程中发生错误

running install
running build
running build_ext
building 'gmpy2' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -g -fdebug-prefix-map=/build/python3.6-LpWKty/python3.6-
3.6.5~rc1=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-
protector-strong -Wformat -Werror=format-security -Wdate-time -
D_FORTIFY_SOURCE=2 -fPIC -DWITHMPFR -DWITHMPC -
I/usr/include/python3.6m -c src/gmpy2.c -o build/temp.linux-x86_64-
3.6/src/gmpy2.o
In file included from src/gmpy2.c:426:0:
src/gmpy.h:252:12: fatal error: mpfr.h: No such file or directory
 #  include "mpfr.h"
            ^~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
`
`
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build-
onv0x975/gmpy2/setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --
record /tmp/pip-izolloyr-record/install-record.txt --single-version-
externally-managed --compile" failed with error code 1 in /tmp/pip-
build-onv0x975/gmpy2/

pip 和 pip3 我都试过了

最佳答案

您需要下载 MPFR 源代码并进行编译。参见安装手册:https://gmpy2.readthedocs.io/en/latest/intro.html#installation

关于python - pip安装模块错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49655444/

相关文章:

python - 通过线程并行化缓慢的 api 调用

python - 在 PyQt5 中打印 pdf 文档

python - 如何在 Django 模板中显示我过滤对象的其他条目

python - pip:证书失败,但 curl 有效

python - Python 中的多元逻辑回归显示错误

Python Flask heroku 应用程序错误

python - 是否有重复重新分配变量的简写?

python - 如何在任何给定时间点从给定字符串中找到前 10 个单词。 Python

python datetime.strftime 不支持日文?

python - 识别 Pandas 数据框中的重复项