在Ubuntu上安装PyCrypto-生成时出现致命错误

2024-04-25 18:09:18 发布

您现在位置:Python中文网/ 问答频道 /正文

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

我试图让它在我的Ubuntu笔记本电脑上工作-但我也无法在我的Windows电脑上管理它。

我下载了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

希望能得到帮助。


Tags: orbuildsrcubuntuwindowssetuperrorcrypto
3条回答

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

sudo apt-get install python-dev

在Ubuntu上,如果你使用Python 3.x,你需要:

sudo apt-get install gcc python3-dev

您可能已经有了gcc,但是如果您使用基本映像python:3.6.4-slim-jessie从Dockerfile尝试这个命令,那么您还需要gcc。

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

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

相关问题 更多 >