我正在尝试通过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
对于造成这种情况的原因有什么想法?
值得注意的是,我在Snow Leopard本地遇到了同样的问题,我可以通过直接下载代码并手动运行python manage.py build
和python manage.py install
来解决问题。我想避免这种情况,因为我正在部署到十几台服务器。
答案 0 :(得分:2)
即使使用最新的pycrypto,我仍然遇到这个问题,所以我只运行./configure
并创建了src / config.h,所以现在只需运行pip或easy_install或者setup.py ...... < / p>
答案 1 :(得分:1)
看来这是一个悬而未决的问题。解决方法是使用pip代替或坚持使用PyCrypto 2.3。 https://bugs.launchpad.net/pycrypto/+bug/881130
编辑:此错误已在PyCrypto 2.4.1中修复。
答案 2 :(得分:1)
正如更新一样,PyCrypto已经解决了这个问题,因为您可以从标记为“已解决修复”的故障单中看到:https://bugs.launchpad.net/pycrypto/+bug/881130。只是一个FYI,以防有人偶然遇到这个问题。这“应该”现在不是问题。
答案 3 :(得分:0)
你也可以下载pycrypto-2.4.tar.gz解压缩并运行(以root身份):
./configure
python setup.py install
之后,pycrypto将被安装到/usr/lib/python2.7/site-packages/Crypto中。我在'easy_install pysnmp'上测试了它。