问题
i'm trying to import pxssh from pexpect. But i get the following error, and i dont know how to solve this.
>>> from pexpect import pxssh
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Python34\lib\site-packages\pexpect\pxssh.py", line 23, in <module>
from pexpect import ExceptionPexpect, TIMEOUT, EOF, spawn
ImportError: cannot import name 'spawn'
Can anyone help? Thanks in advance!
回答1:
Please check if your Pexpect version is something like 2.3, if so, you need to update the package to 4.2 or greater. To do it run the following:
sudo easy_install --upgrade pexpect
来源:https://stackoverflow.com/questions/36087711/cant-import-pxssh-from-pexpect