问题描述
Windows 系统上安装了一个 Python 的第三方包 pexpect
,调用包函数的时候报错。
>>> import pexpect
>>> pexpect.spawn('ping baidu.com')
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'pexpect' has no attribute 'spawn'
解决方案
pexpect 对 Window 的支持非常有限,目前只能在 Unix 系统里面使用。
引用参考https://github.com/pexpect/pexpect/issues/567