[英]How to get Python m2Crypto to work with virtualenv?
我正在嘗試安裝M2Crypto,以便我可以在我的網絡應用程序中生成pkey。 我的托管要求規定我必須使用pip來安裝任何依賴項。 在系統級別安裝m2crypto對我來說不是一個選擇。 我正在開發中使用Mint 12並將部署到heroku。
錯誤:命令'swig'失敗,退出狀態1看起來像問題,但谷歌沒有幫助。 思考?
傾倒
Downloading/unpacking m2crypto
Downloading M2Crypto-0.21.1.tar.gz (413Kb): 413Kb downloaded
Running setup.py egg_info for package m2crypto
Installing collected packages: m2crypto
Running setup.py install for m2crypto
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.7 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
unable to execute swig: No such file or directory
error: command 'swig' failed with exit status 1
Complete output from command /home/bob/.virtualenvs/my_app/bin/python -c "import setuptools;__file__='/home/bob/.virtualenvs/my_app/build/m2crypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-O1V45n-record/install-record.txt --install-headers /home/bob/.virtualenvs/my_app/include/site/python2.7:
running install
running build
(....clip...)
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.7 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
unable to execute swig: No such file or directory
error: command 'swig' failed with exit status 1
----------------------------------------
Command /home/bob/.virtualenvs/my_app/bin/python -c "import setuptools;__file__='/home/bob/.virtualenvs/my_app/build/m2crypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-O1V45n-record/install-record.txt --install-headers /home/bob/.virtualenvs/my_app/include/site/python2.7 failed with error code 1 in /home/bob/.virtualenvs/my_app/build/m2crypto
你的問題與virtualenv無關。 你剛剛沒有安裝swig。
使用您的發行版的軟件包管理器安裝swig,並嘗試在virtualenv中重新安裝M2Crypto。
我用OSX在我的Mac上的VirtualEnv中pip install M2Crypto
解決方案如下:
答:退出virtualenv
B:使用以下鏈接下載Swig,然后按照安裝它的INSTALL文本文檔說明進行操作。
http://sourceforge.net/projects/swig/?source=dlp
C:安裝PCRE開發人員版本也是因為Swig需要它才能運行。 請按照以下鏈接和安裝它的INSTALL文本文檔說明進行操作。
http://sourceforge.net/projects/pcre/?source=dlp
D:回到我的virtualenv
,我試圖首先安裝M2Crypto,激活virtualenv
,然后運行:
pip install M2Crypto
看起來錯誤消息是說無法找到swig。 在你的virtualenv和你的道路上開玩笑嗎?
此外,要使M2Crypto工作,您將需要訪問OpenSSL安裝。 如果您無法鏈接系統的安裝,則需要在本地virtualenv中安裝它並指向link / library / include語句以使用它。
對不起,它不是更清楚。 我認為問題是swig不在你的道路上。 錯誤消息說:
無法執行swig:沒有這樣的文件或目錄
如果從命令提示符運行'swig'會發生什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.