无法在Windows 8.1 64位计算机上安装M2Crypto软件包

时间:2015-05-13 18:34:33

标签: python windows m2crypto

我正在使用安装了Python 2.7的Win8.1 64位计算机。我已经安装了swigwin 3.0.5。当我做“pip install M2Crypto”时,我收到了以下错误:

SWIG\_m2crypto.i(30) : Error: Unable to find 'openssl\opensslv.h'

SWIG\_m2crypto.i(33) : 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\o,pensslconf.h'

在某些链接中,我发现建议安装openssl-dev。但我找不到Windows的等效包(pip install openssl-dev不起作用,我已经完成了pip install pyOpenSSL,这对我没用)。

提前致谢。

2 个答案:

答案 0 :(得分:0)

在Windows上安装M2Crypto很痛苦。幸运的是,有些人已经开始为M2Crypto创建Windows安装程序:

您也可以直接从M2Crypto的制造商那里使用稍微较旧版本的软件包,因为他们实际上提供了一段时间的Windows可安装版本:

这也是一个有用的链接:

答案 1 :(得分:0)

我通过以下方式解决了问题(在Windows上的MiniConda安装中):

  1. conda install openssl
  2. 将< MiniConda目录> \ envs \< environment> \ Library \ include \ openssl复制到< MiniConda目录> \ envs \< environment> \ include \ openssl(或mklink it)
  3. 它也可能适用于其他Python环境。

    但是,我遇到了更多问题(我不知道如何解决):

        building 'M2Crypto.__m2crypto' extension
        swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
        C:\Program Files\MiniConda3\envs\python2\Library\bin\swig.exe -python "-IC:\Program Files\MiniConda3\envs\python2\include" "-IC:\Program Files\MiniConda3\envs\python2\PC" -Ic:\pkg\include -include
    all -modern -builtin -outdir build\lib.win-amd64-2.7\M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
        SWIG\_bio.i(64) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_rand.i(23) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_evp.i(180) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_dh.i(36) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_rsa.i(43) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_dsa.i(31) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_ssl.i(241) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_ssl.i(242) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_x509.i(332) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_pkcs7.i(44) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_pkcs7.i(44) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_util.i(11) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_ec.i(111) : Warning 454: Setting a pointer/reference variable may leak memory.
        SWIG\_engine.i(168) : Warning 454: Setting a pointer/reference variable may leak memory.
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "c:\users\pal\appdata\local\temp\pip-build-reeqlh\M2Crypto\setup.py", line 280, in <module>
            'clean': Clean
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\core.py", line 151, in setup
            dist.run_commands()
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\dist.py", line 953, in run_commands
            self.run_command(cmd)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\dist.py", line 972, in run_command
            cmd_obj.run()
          File "C:\Program Files\MiniConda3\envs\python2\lib\site-packages\setuptools\command\install.py", line 53, in run
            return _install.run(self)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\command\install.py", line 563, in run
            self.run_command('build')
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\cmd.py", line 326, in run_command
            self.distribution.run_command(command)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\dist.py", line 972, in run_command
            cmd_obj.run()
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\command\build.py", line 127, in run
            self.run_command(cmd_name)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\cmd.py", line 326, in run_command
            self.distribution.run_command(command)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\dist.py", line 972, in run_command
            cmd_obj.run()
          File "c:\users\pal\appdata\local\temp\pip-build-reeqlh\M2Crypto\setup.py", line 148, in run
            build_ext.build_ext.run(self)
          File "C:\Program Files\MiniConda3\envs\python2\lib\site-packages\setuptools\command\build_ext.py", line 46, in run
            _build_ext.run(self)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\command\build_ext.py", line 339, in run
            self.build_extensions()
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\command\build_ext.py", line 448, in build_extensions
            self.build_extension(ext)
          File "C:\Program Files\MiniConda3\envs\python2\lib\site-packages\setuptools\command\build_ext.py", line 182, in build_extension
            _build_ext.build_extension(self,ext)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\command\build_ext.py", line 498, in build_extension
            depends=ext.depends)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\msvc9compiler.py", line 473, in compile
            self.initialize()
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\msvc9compiler.py", line 383, in initialize
            vc_env = query_vcvarsall(VERSION, plat_spec)
          File "C:\Program Files\MiniConda3\envs\python2\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsall
            raise ValueError(str(list(result.keys())))
        ValueError: [u'path']
    
        ----------------------------------------
    Command ""C:\Program Files\MiniConda3\envs\python2\python.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\pal\\appdata\\local\\temp\\pip-build-reeqlh\\M2Crypto\\setup.py';exec(compile(get
    attr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\pal\appdata\local\temp\pip-opk8he-record\install-record.txt --single-version-external
    ly-managed --compile" failed with error code 1 in c:\users\pal\appdata\local\temp\pip-build-reeqlh\M2Crypto\