开发者

How to install wexpect?

开发者 https://www.devze.com 2022-12-26 19:38 出处:网络
I\'m running 32-bit Windows XP and trying to have Matlab communicate with Cgate, a command line program.I\'d like to make this happen using wexpect, which is a port of Python\'s module pexpect to Wind

I'm running 32-bit Windows XP and trying to have Matlab communicate with Cgate, a command line program. I'd like to make this happen using wexpect, which is a port of Python's module pexpect to Windows. I'm having trouble installing or importing wexpect though. I've put wexpect in the folder Lib, along with all other modules. I can imp开发者_JAVA技巧ort those other modules but just not wexpect. Commands I've tried include:

import wexpect
import wexpect.py
python wexpect.py install
python wexpect.py install --home=~
wexpect install

Does anyone have anymore ideas?


If you installed wexpect somewhere in the module search path (sys.path), then import wexpect is what you would use. You have to make sure you installed it in the right path, though (the usual location is Lib\site-packages inside the Python installation.) If the package wexpect.py was in came with a setup.py file, you could install it with

\path\to\python setup.py install

from a DOS prompt. Depending on what else you did you may need to restart the Python interpreter or IDE that you're using for it to pick it up. You should also pay attention to the errors you get when you try import wexpect, as it may have dependencies you need to install.


Perhaps you haven't installed wexpect correctly.

In your command prompt (not python, but the DOS-like command shell), go to the directory where you downloaded wexpect. Make sure it's unzipped and you can see the setup.py file when you use the dir command.

Then enter the command (again, in the cmd shell, not the python terminal):

python setup.py install.


I have created a Github repo and PyPI project for wexpect. So now wexpect can be installed with:

pip install wexpect

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号