Python pycrypto 安装错误

12

可能重复问题:
PyCrypto和GMP库未找到错误[Mac OS 10.6.3]

我正在尝试在Ubuntu上安装pycrypto,但是它抛出了错误。

hom@PC71:~/Desktop/pycrypto-2.3$ sudo python setup.py build
running build
running build_py
running build_ext
warning: GMP 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.6 -c src/MD2.c -o build/temp.linux-i686-2.6/src/MD2.o
src/MD2.c:31: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
我已经安装了Python开发工具。
1个回答

42

您缺少Python开发库。(尝试 apt-get install python-dev.)

然而,除非您有编译pycrypto的有效理由,否则只需通过(我认为) apt-get install python-crypto安装即可。


适用于Linux:如果您已安装了GMP但没有Python dev库,则需要在安装pycrypto之前先获取它们。 - Ross
1
"apt-get install python-crypto" 在我的树莓派上成功了,谢谢!" - armani
2
这解决了我在通过pip升级Ansible所需的依赖项时遇到的问题:sudo pip install ansible --upgrade(其中之一是pycrypto)。 - Justin Watt
对于其他试图在Python3上安装的人,您需要执行apt-get install python3-dev - matrixanomaly

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接