在python3.6上安装pycrypto

tuwxkamq  于 2022-11-07  发布在  Python
关注(0)|答案(2)|浏览(219)

我正在用Python 3.6运行Centos7。我试图用命令“pip3 install pycrypto”安装pycrypto。我还安装了dev工具,所以gcc也安装了。我得到了下面的输出。我遗漏了什么?

warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Hash._MD2' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wno-unused-result -Wsign-compare -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.6m -c src/MD2.c -o build/temp.linux-x86_64-3.6/src/MD2.o
    src/MD2.c:31:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-h6pl3s2f/pycrypto/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-9fjag3e5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-h6pl3s2f/pycrypto/
vom3gejh

vom3gejh1#

这并不奏效,但我确实在文章中找到了答案。
我运行了“Yum -Y安装Python3-Devel”,这修复了我的问题。然后我就可以安装Pycrypto了。

fcy6dtqo

fcy6dtqo2#

我在CentOS上也遇到了同样的问题。但是,结果发现我缺少了一个依赖项。

sudo yum install gcc

sudo yum install gcc-c++

sudo yum install python-devel

sudo pip install pycrypto

相关问题