在Ubuntu上安装PyCrypto – 编译时发生致命错误

看了其他类似的线程,我仍然无法运行pycrypto。

我试图让它在我的Ubuntu笔记本电脑上工作 – 但我无法在Windows PC上pipe理它。

我下载了pycrypto-2.6,解压缩,然后运行

python setup.py build 

但是这发生了

 warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Hash._MD2' extension gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 - fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-?2.7/src/MD2.o src/MD2.c:31:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 

将不胜感激任何帮助。

您需要安装Python开发文件。 我相信这将做到这一点:

 sudo apt-get install python-dev 

在Ubuntu上,我需要一些其他的软件包才能成功:

 apt-get install autoconf g++ python2.7-dev pip install pycrypto