无法在安装后运行pywin32

时间:2014-08-14 18:16:01

标签: python pywin32

我试图在AMD处理器上的Windows 7 64位上使用winpexpect。为此,我安装了名为pywin32-214.win-amd64-py2.7的可执行文件pywin32。图形安装程序似乎成功运行,但是当我尝试导入winpexpect时出现此错误:

>>> import winpexpect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Alexei\wordseer_flask\venv\lib\site-packages\winpexpect.py", li
ne 11, in <module>
    import pywintypes
  File "C:\Users\Alexei\wordseer_flask\venv\lib\site-packages\pywin32-214-py2.7-
win32.egg\pywintypes.py", line 124, in <module>
    __import_pywin32_system_module__("pywintypes", globals())
  File "C:\Users\Alexei\wordseer_flask\venv\lib\site-packages\pywin32-214-py2.7-
win32.egg\pywintypes.py", line 64, in __import_pywin32_system_module__
    import _win32sysloader
ImportError: DLL load failed: %1 is not a valid Win32 application.

当我尝试运行C:\Python27\Scripts\pywin32_postinstall时:

C:\Windows\system32>C:\Python27\Scripts\pywin32_postinstall.py -install
Traceback (most recent call last):
  File "C:\Python27\Scripts\pywin32_postinstall.py", line 601, in <module>
    install()
  File "C:\Python27\Scripts\pywin32_postinstall.py", line 311, in install
    LoadSystemModule(lib_dir, "pywintypes")
  File "C:\Python27\Scripts\pywin32_postinstall.py", line 149, in LoadSystemModu
le
    ('.dll', 'rb', imp.C_EXTENSION))
ImportError: DLL load failed: %1 is not a valid Win32 application.

2 个答案:

答案 0 :(得分:0)

当我安装pyinstaller时,我也遇到了同样的错误: import _win32sysloader ImportError: DLL load failed: The specified module could not be found. 安装Microsoft Visual C ++ 2010 Redistributable Package修复了错误。

答案 1 :(得分:-1)

如果Python或PyWin32中的任何一个是32位,那么另一个也应该是。

尝试从http://www.lfd.uci.edu/~gohlke/pythonlibs/

安装