【问题标题】:install pycrypto on python3.6在 python3.6 上安装 pycrypto
【发布时间】:2020-11-18 09:28:44
【问题描述】:

我正在使用 Python 3.6 运行 Centos7。我正在尝试使用命令“pip3 install pycrypto”安装 pycrypto。我还安装了开发工具,所以安装了 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/

【问题讨论】:

标签: python python-3.x centos centos7


【解决方案1】:

这没有用,但我确实在文章中找到了答案。

我运行了“yum -y install python3-devel”,这解决了我的问题。然后我就可以安装pycrypto了。

【讨论】:

    【解决方案2】:

    对于 CentOS,我也遇到了同样的问题。 但是,事实证明我缺少其中一个依赖项。

    sudo yum install gcc
    
    sudo yum install gcc-c++
    
    sudo yum install python-devel
    
    sudo pip install pycrypto
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-26
      • 2012-07-09
      • 1970-01-01
      • 2019-01-14
      • 2013-09-04
      • 2017-07-26
      • 2019-03-28
      • 2020-01-25
      相关资源
      最近更新 更多