4

我正在尝试在 Windows XP 平台上安装 M2Crypto。我安装了 Python、easy_install 和 SWIG,但是当我尝试easy_install M2Crypto得到以下信息时:

SWIG\_m2crypto.i(31) : Error: Unable to find 'openssl\opensslv.h'
SWIG\_m2crypto.i(45) : Error: Unable to find 'openssl\safestack.h'
SWIG\_evp.i(12) : Error: Unable to find 'openssl\opensslconf.h'
SWIG\_ec.i(7) : Error: Unable to find 'openssl\opensslconf.h'
error: Setup script exited with error: command 'swig.exe' failed with exit status 1

我在其他地方读过人们建议easy_install openssl-devel的内容,但这只是告诉我没有找到具有该名称的包。该名称是否可能区分大小写(我尝试了各种排列但没有成功),还是该建议不适用于 Windows?

我不是在寻找 M2Crypto 的替代品。我正在挑选一些使用它的现有代码,所以我需要让我的开发环境能够运行已经编写的内容。

4

2 回答 2

8

正如杰伊在他的回答中所说,您应该尝试从源代码构建它。我试过了。setup.py不识别该选项--openssl。查看默认的输出,setup.py我意识到搜索位置是c:\pkg而不是c:\pkg\openssl。解决方案:

  1. 从Win32 OpenSSL下载并安装OpenSSL
  2. libinclude文件夹复制到c:\pkg
  3. 检查swig.exe您的路径中是否可用
  4. easy_install M2Crypto

像魅力一样为我工作。

于 2012-09-27T09:32:05.913 回答
4

有类似的问题。下载 M2Crypto 的源代码包并阅读 INSTALL 文件后,我发现以下内容:

Differences when installing on Windows
--------------------------------------

Before building from source, you need to install OpenSSL's include files,
import libraries and DLLs. By default setup.py assumes that OpenSSL include
files are in ``c:\pkg\openssl\include``, and the import libraries 
in ``c:\pkg\openssl\lib``. As with other platforms, you can specify a different
OpenSSL location with --openssl option to build_ext command.
于 2011-06-24T07:50:01.547 回答