No module named win32console, while running wexpec

2019-08-05 09:06发布

问题:

I want to run wexpect (the windows port of pexpect) on my Windows 7 64-bit machine. I am getting the following error:

C:\Program Files (x86)\wexpect\build\lib>wexpect.py
Traceback (most recent call last):
  File "C:\Program Files (x86)\wexpect\build\lib\wexpect.py", line 97, in <module>
    raise ImportError(str(e) + "This package was intended for Windows like operating systems.")
ImportError: No module named win32console This package requires the win32 python packages.This package was intended for Windows like operatin
g systems.

In the code it is failing on the following line: from win32console import *

I am using Python 2.6.4. I cannot figure out how to install win32console.

回答1:

Install this: http://sourceforge.net/projects/pywin32/

Edit to add slightly longer explanation: There's a very useful set of Windows-specific Python modules, called PyWin32. I believe win32console is part of that. You can either install PyWin32 on top of the standard python.org release of Python, or you can install ActiveState ActivePython which bundles everything you need all together. I'm using ActivePython and I have a win32console module.