无法安装模块python pip

无法安装模块python pip,python,pip,snmp,Python,Pip,Snmp,我是python新手。我想使用pysnmp模块,所以我尝试使用pip安装它,但我从中得到错误: Failed building wheel for pycrypto 我在多系统Ubuntu、Debian和RH上试过,我总是遇到同样的错误。如何安装pysnmp?或者,有没有其他替代方案可以与snmp和python一起使用 Shell命令: sudo -H pip install pysnmp 结果: ... configure: creating ./config.status

我是python新手。我想使用pysnmp模块,所以我尝试使用pip安装它,但我从中得到错误:

Failed building wheel for pycrypto
我在多系统Ubuntu、Debian和RH上试过,我总是遇到同样的错误。如何安装pysnmp?或者,有没有其他替代方案可以与snmp和python一起使用

Shell命令:

sudo -H pip install pysnmp
结果:

...
    configure: creating ./config.status
    config.status: creating src/config.h
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastm                                                                                                 ath.
    building 'Crypto.Hash._MD2' extension
    creating build/temp.linux-x86_64-3.4
    creating build/temp.linux-x86_64-3.4/src
    x86_64-linux-gnu-gcc -pthread -fwrapv -Wall -Wstrict-prototypes -fstack-prot                                                                                                 ector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOUR                                                                                                 CE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.4m -c                                                                                                  src/MD2.c -o build/temp.linux-x86_64-3.4/src/MD2.o
    src/MD2.c:31:20: fatal error: Python.h: No such file or directory
     #include "Python.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-7gwchpkq/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(_                                                                                                 _file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp                                                                                                 /pip-6mlabkyq-record/install-record.txt --single-version-externally-managed --co                                                                                                 mpile" failed with error code 1 in /tmp/pip-build-7gwchpkq/pycrypto/
试试看

试试看

尝试:

尝试:

src/MD2.c:31:20:致命错误:Python.h:没有这样的文件或目录

实际错误是您没有python语言python.h的dev文件找不到

因此,请安装python开发人员:

src/MD2.c:31:20:致命错误:Python.h:没有这样的文件或目录

实际错误是您没有python语言python.h的dev文件找不到

因此,请安装python开发人员:


尝试了sudo-pip安装pysnmp和sudo-H-pip安装pysnmp,效果良好。我还卸载了pycrypto并将其安装为新的、有效的。我对sudo-pip-install-pysnmp和sudo-H-pip-install-pysnmp进行了测试,结果都正常了。我还卸载了pycrypto并安装了新的,workedI get要求已经是最新的:setuptools in/usr/local/lib/python3.4/dist-packages/setuptools-20.3.1-py3.4.eggI在另一个线程上发现了这一点:apt cache search python3 dev sudo apt get install python3 dev pip install pycryptoI get要求已经是最新的:setuptools in/usr/local/lib/python3.4/dist-packages/setuptools-20.3.1-py3.4.eggI在另一个线程上找到了这个:apt cache search python3 dev sudo apt get install python3 dev pip install pycryptoI获取:运行pycrypto-2.6.1/setup.py-q bdist_egg-dist dir/tmp/easy_install-g0ahfypto/pycrypto-2.6.1/egg-dist-tmp-20rtwgcx警告:GMP或MPIR库不可用建立不建立加密公钥。src/MD2.c:31:20:致命错误:Python.h:没有此类文件或目录包含Python.h^编译已终止。错误:安装程序脚本退出,出现错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1I获取以下信息:正在运行pycrypto-2.6.1/Setup.py-q bdist_egg-dist dir/tmp/easy_install-g0ahfypn/pycrypto-2.6.1/egg-dist-tmp-20rtwgcx警告:找不到GMP或MPIR库;不建立加密公钥。src/MD2.c:31:20:致命错误:Python.h:没有此类文件或目录包含Python.h^编译已终止。错误:安装程序脚本退出,出现错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1
wget https://bootstrap.pypa.io/ez_setup.py

python ez_setup.py

easy_install pysnmp
sudo pip install setuptools --upgrade
sudo apt-get install  python-dev