怎么了

$ python -V
Python 2.7.5


我已经安装了pip install pexcept

现在,当我加载它

$ python
Python 2.7.5 (default, Jul 13 2018, 13:06:57)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pexpect.py", line 10, in <module>
    child = pexpect.spawn('ssh %s@%s' % (switch_un, switch_ip))
AttributeError: 'module' object has no attribute 'spawn'
>>>


编辑

运行Linux CentOS 7.x版本(64位)

最佳答案

如前所述,HERE pexpect主要用于基于UNIX的操作系统。使用Windows时出现此错误。

关于python - pexpect AttributeError:“模块”对象没有属性“生成”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59308566/

10-13 03:26