2011-10-25 43 views
3

我試圖通過構建(通過easy_install)在Ubuntu實例上安裝PyCrypto,並且出現以下錯誤:試圖通過構建,src/config.h在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 buildpython manage.py install來修復它。我想避免這一點,因爲我正在部署到十幾臺服務器。

+0

您可以嘗試詢問serverfault ... – retracile

+0

其他人有相同的問題:http://stackoverflow.com/questions/7897486/missing-src-config-h-when-trying-to-install-pycrypto-通過易安裝 – retracile

回答

0

您也可以下載pycrypto-2.4.tar.gz解壓縮並運行(作爲root):

./configure 
python setup.py install 

之後pycrypto將被安裝到/usr/lib/python2.7/site-packages /加密。我在'easy_install pysnmp'上測試過它。

2

即使是最新的pycrypto我一直有這個問題,所以我只是跑./configure和Src/config.h中被創建,所以現在只需運行PIP或easy_install的或setup.py ...

1

就像更新一樣,PyCrypto已經解決了這個問題,正如您從標記爲「Fix Resolved」的票證中看到的那樣:https://bugs.launchpad.net/pycrypto/+bug/881130。只是一個供參考,以防有人在以後遇到這種情況。這個「應該」現在不是問題。

相關問題