Python 导入错误:没有名为 pxssh 的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21883912/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImportError: No module named pxssh
提问by Petr Mensik
I am trying to use pxsshmodule to make SSH connection to the client - however I am getting
我正在尝试使用pxssh模块与客户端建立 SSH 连接 - 但是我得到了
ImportError: No module named pxssh
I found this file in Python installation so I would guess that's correct
我在 Python 安装中找到了这个文件,所以我猜这是正确的
/usr/lib/python2.7/site-packages/pexpect/pxssh.py
I am of course running my app with Python 2.7 and I've even tried to import pexpectbut that didn't help.
我当然使用 Python 2.7 运行我的应用程序,我什至尝试导入,pexpect但这没有帮助。
So, any hints?Thanks
那么,有什么提示吗?谢谢
采纳答案by zhangxaochen
Well, try from pexpect import pxssh.
嗯,试试from pexpect import pxssh。
update:
更新:
The solution only works for Linux as pxsshis not supported on Windows
该解决方案仅适用于 Linux,因为pxsshWindows 不支持
回答by anask
If the problem is not resolved by the earlier suggestion:
如果之前的建议没有解决问题:
from pexpect import pxssh
The pexpect library might be outdated, so run:
pexpect 库可能已经过时,所以运行:
sudo pip install pexpect --upgrade
回答by Nanda Kishore
If /usr/lib/python2.7/site-packages/pexpect/pxssh.py exists, then use the below command
如果 /usr/lib/python2.7/site-packages/pexpect/pxssh.py 存在,则使用以下命令
python2.7 'yourprogram.py'
python2.7 '你的程序.py'
as python command is not linked to 2.7 version. Please check python -V to get the version.
因为 python 命令未链接到 2.7 版本。请检查 python -V 以获取版本。

