python pycrypto安装错误

shi*_*ivg 12 python pycrypto

可能重复:
未找到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
Run Code Online (Sandbox Code Playgroud)

我已经安装了python-dev工具.

AKX*_*AKX 42

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

但是,除非你有充分的理由自己编译pycrypto,否则只需通过(我认为)安装即可apt-get install python-crypto.

  • 这解决了我在安装通过pip升级Ansible所需的依赖项过程中遇到的问题:`sudo pip install ansible --upgrade`(其中一个是pycrypto) (2认同)