问题描述

Windows 系统上安装了一个 Python 的第三方包 pexpect,调用包函数的时候报错。

>>> import pexpect
>>> pexpect.spawn('ping baidu.com')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pexpect' has no attribute 'spawn'

解决方案

pexpect 对 Window 的支持非常有限,目前只能在 Unix 系统里面使用。

引用参考

https://github.com/pexpect/pexpect/issues/567

Logo

GitCode AI社区是一款由 GitCode 团队打造的智能助手,AI大模型社区、提供国内外头部大模型及数据集服务。

更多推荐