这是我试图运行的代码:
from pexpect import pxssh
s = pxssh.pxssh()
if not s.login ('myip', 'myusername', 'mypassword'):
print ("SSH session failed on login.")
print (str(s))
else:
print ("SSH session login successful")
s.sendline ('ls -l')
s.prompt() # match the prompt
print (s.before) # print everything before the prompt.
s.logout()
我在运行此错误时遇到的错误是:
Traceback (most recent call last):
File "test_pexpect.py", line 1, in <module>
from pexpect import pxssh
File "C:\Python35\lib\site-packages\pexpect\pxssh.py", line 23, in <module>
from pexpect import ExceptionPexpect, TIMEOUT, EOF, spawn
ImportError: cannot import name 'spawn'
任何人都可以帮助我吗?我在windows上使用python3.5