我试图通过Buildout(通过easy_install)在Ubuntu实例上安装PyCrypto,我得到以下错误:
Getting distribution for 'pycrypto>=1.9'.
Running easy_install:
/usr/bin/python "-S" "-c" "import sys,os;p = sys.path[:];import site;sys.path[:] = p; [sys.modules.pop(k) for k, v in sys.modules.items() if hasattr(v, '__path__') and len(v.__path__)==1 and not os.path.exists(os.path.join(v.__path__[0],'__init__.py'))];from setuptools.command.easy_install import main;main()" "-mUNxd" "/opt/rocktech/buildout/cache/eggs/tmppKIfK7" "-Z" "/opt/rocktech/buildout/cache/download/dist/pycrypto-2.4.tar.gz"
path=/opt/rocktech/buildout/cache/eggs/setuptools-0.6c12dev_r88846-py2.6.egg
Processing pycrypto-2.4.tar.gz
Running pycrypto-2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dD_8Pu/pycrypto- 2.4/egg-dist-tmp-_d3xDl
error: Setup script exited with error: src/config.h: No such file or directory
An error occurred when trying to install pycrypto 2.4. Look above this message for any errors that were output by easy_install.
While:
Installing django.
Getting distribution for 'pycrypto>=1.9'.
Error: Couldn't install: pycrypto 2.4
知道是什么引起的吗?
值得注意的是,我在雪豹本地有同样的问题,我能够通过直接下载代码并手动运行python manage.py build
和python manage.py install
来修复它。这里我要避免这个,因为我要部署到十几台服务器。
即使是最新的pycrypto我一直有这个问题,所以我只是运行./configure
和src/config.h被创建,所以现在只是运行pip或,easy_install或,setup.py…
您也可以下载pycrypto-2.4.tar.gz解压并运行(以root用户):
./configure
python setup.py install
之后pycrypto将被安装到/usr/lib/python2.7/site-packages/Crypto。我在"easy_install pysnmp"上进行了测试。
看来这是一个悬而未决的问题。解决方法是使用pip代替或坚持使用PyCrypto 2.3。https://bugs.launchpad.net/pycrypto/+ bug/881130
编辑:此错误已在PyCrypto 2.4.1中修复。
就像一个更新一样,PyCrypto已经解决了这个问题,你可以从标记为"Fix resolved "的票证中看到:https://bugs.launchpad.net/pycrypto/+bug/881130。仅供参考,以防以后有人看到这个。这"应该"不是问题了