4

我正在尝试通过 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 buildpython manage.py install手动运行来修复它。我想在这里避免这种情况,因为我正在部署到十几台服务器。

4

4 回答 4

2

即使使用最新的 pycrypto,我仍然遇到这个问题,所以我只是运行./configure并创建了 src/config.h,所以现在只需运行 pip 或 easy_install 或 setup.py ...

于 2012-01-19T12:22:03.823 回答
1

正如更新一样,PyCrypto 已经解决了这个问题,正如您从标有“已解决”的票证中看到的那样:https ://bugs.launchpad.net/pycrypto/+bug/881130 。仅供参考,以防以后有人遇到此问题。这个“应该”现在不是问题。

于 2012-01-22T04:46:42.860 回答
1

看来这是一个悬而未决的问题。解决方法是改用 pip 或坚持使用 PyCrypto 2.3。https://bugs.launchpad.net/pycrypto/+bug/881130

编辑:此错误已在 PyCrypto 2.4.1 中修复。

于 2011-10-25T22:47:59.257 回答
1

你也可以下载 pycrypto-2.4.tar.gz 解压并运行(以 root 身份):

./configure
python setup.py install

之后 pycrypto 将被安装到 /usr/lib/python2.7/site-packages/Crypto。我在“easy_install pysnmp”上对其进行了测试。

于 2011-11-04T11:16:02.573 回答