如何让Python m2Crypto与virtualenv一起工作?

如何让Python m2Crypto与virtualenv一起工作?,python,virtualenv,m2crypto,Python,Virtualenv,M2crypto,我正在尝试安装M2Crypto,以便在我的web应用程序中生成pkey。我的托管要求要求我必须使用pip来安装任何依赖项。在系统级安装m2crypto不是我的选择。我正在开发中使用Mint 12,并将部署到heroku 错误:命令“swig”失败,退出状态为1看起来是问题,但谷歌没有帮助。 想法 转储 Downloading/unpacking m2crypto Downloading M2Crypto-0.21.1.tar.gz (413Kb): 413Kb downloaded Ru

我正在尝试安装M2Crypto,以便在我的web应用程序中生成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

看起来错误消息是说找不到swig。swig在你的虚拟世界里,在你的道路上吗


另外,为了让M2Crypto工作,您需要访问OpenSSL安装。如果您无法针对系统安装进行链接,则需要在本地virtualenv中安装它,并指向您的链接/库/include语句以使用它。

很抱歉,它不够清晰。我认为问题在于swig不在你的道路上。错误消息显示:

无法执行swig:没有这样的文件或目录


如果从命令提示符下运行“swig”,会发生什么情况?

您的问题与virtualenv无关。你只是没有安装swig


使用发行版的软件包管理器安装swig,并尝试在virtualenv中重新安装M2Crypto。

我的解决方案是在我的Mac上使用OSX在我的virtualenv中安装M2Crypto,如下所示:

A:退出虚拟电视

B:使用以下链接下载Swig,并按照安装文本文档中的安装说明进行安装

C:也安装PCRE开发人员版本,因为Swig需要它来运行。请按照下面的链接和安装文本文档的说明进行安装

D:回到我最初尝试安装M2Crypto的
virtualenv
,激活
virtualenv
,然后运行:

pip install M2Crypto
你所说的“swig在你的虚拟世界和你的道路上吗?”是什么意思?我想答案是否定的。