我尝试在windows 7 64bits上使用winpexpect和python 2.6。

>>> import winpexpect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python26\lib\site-packages\winpexpect-1.6-py2.6.egg\winpexpect.py", l
ine 11, in <module>
    import pywintypes
  File "C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 124, in <mo
dule>
    __import_pywin32_system_module__("pywintypes", globals())
  File "C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 98, in __im
port_pywin32_system_module__
    raise ImportError("No system module '%s' (%s)" % (modname, filename))
ImportError: No system module 'pywintypes' (pywintypes26.dll)

或者安装没有引发任何错误:
Extracting winpexpect-1.6-py2.6.egg to c:\python26\lib\site-packages
winpexpect 1.6 is already the active version in easy-install.pth

Installed c:\python26\lib\site-packages\winpexpect-1.6-py2.6.egg
Processing dependencies for winpexpect==1.6
Searching for pywin32==218
Best match: pywin32 218
Adding pywin32 218 to easy-install.pth file
Using c:\python26\lib\site-packages

最佳答案

winpexpect取决于pywin32。您可以找到安装文件here
Use this link下载系统的最新版本。(Python2.6 64位版本)

关于python - 无法启动python winpexpect库,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17567012/

10-11 16:52