No module named win32console, while running wexpect

泄露秘密 提交于 2019-12-11 09:27:41

问题


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.




回答2:


Install wexpect with pip to install all dependencies (inluding pywin32).

pip install wexpect



来源:https://stackoverflow.com/questions/2559731/no-module-named-win32console-while-running-wexpect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!