easy_install M2Crypto在Windows平台上失败

时间:2011-06-22 08:07:38

标签: windows openssl easy-install m2crypto

我正在尝试在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的替代品。我正在挑选一些使用它的现有代码,所以我需要让我的开发环境能够运行已经编写的代码。

2 个答案:

答案 0 :(得分:8)

正如杰伊在答案中所述,你应该尝试从源头构建它。我试过了。 setup.py无法识别--openssl选项。查看默认setup.py的输出,我发现搜索位置为c:\pkg而非c:\pkg\openssl。 解决方案:

  1. Win32 OpenSSL
  2. 下载并安装OpenSSL
  3. libinclude文件夹复制到c:\pkg
  4. 检查路径中是否有swig.exe
  5. 运行easy_install M2Crypto
  6. 为我工作就像一个魅力。

答案 1 :(得分:3)

有类似的问题。下载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.