Python 无法在 Windows 上导入 M2Crypto
Python cannot import M2Crypto on Windows
在新安装的机器(win10 64 位)上,我安装了 python 2.7.11(64 位),现在使用 pip install --egg M2CryptoWin64
安装了 M2Crypto 但是,尝试导入它会出现以下错误(详细跟踪):
>>> import M2Crypto
# C:\Python27\lib\encodings\cp850.pyc matches C:\Python27\lib\encodings\cp850.py
import encodings.cp850 # precompiled from C:\Python27\lib\encodings\cp850.pyc
import M2Crypto # directory C:\Python27\lib\site-packages\M2Crypto
# C:\Python27\lib\site-packages\M2Crypto\__init__.pyc matches C:\Python27\lib\site-packages\M2Crypto\__init__.py
import M2Crypto # precompiled from C:\Python27\lib\site-packages\M2Crypto\__init__.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\M2Crypto\__init__.py", line 22, in <module>
import __m2crypto
ImportError: DLL load failed: The specified module could not be found.
我的站点包中有一个 M2Crypto 文件夹,所以这里可能出了什么问题?
使用 dependency walker 我发现计算机上缺少 MSVCR100.DLL
,这显然是需要的。这是 Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) 的一部分,可在此处下载和安装:https://www.microsoft.com/en-us/download/details.aspx?id=13523
重启命令行后导入成功。
在新安装的机器(win10 64 位)上,我安装了 python 2.7.11(64 位),现在使用 pip install --egg M2CryptoWin64
安装了 M2Crypto 但是,尝试导入它会出现以下错误(详细跟踪):
>>> import M2Crypto
# C:\Python27\lib\encodings\cp850.pyc matches C:\Python27\lib\encodings\cp850.py
import encodings.cp850 # precompiled from C:\Python27\lib\encodings\cp850.pyc
import M2Crypto # directory C:\Python27\lib\site-packages\M2Crypto
# C:\Python27\lib\site-packages\M2Crypto\__init__.pyc matches C:\Python27\lib\site-packages\M2Crypto\__init__.py
import M2Crypto # precompiled from C:\Python27\lib\site-packages\M2Crypto\__init__.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\M2Crypto\__init__.py", line 22, in <module>
import __m2crypto
ImportError: DLL load failed: The specified module could not be found.
我的站点包中有一个 M2Crypto 文件夹,所以这里可能出了什么问题?
使用 dependency walker 我发现计算机上缺少 MSVCR100.DLL
,这显然是需要的。这是 Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) 的一部分,可在此处下载和安装:https://www.microsoft.com/en-us/download/details.aspx?id=13523
重启命令行后导入成功。