即使已安装,也无法导入 pty 模块
我在 OpenSUSE 上安装了 Python 2.7。我正在使用 pty 模块生成一些 pty:
import pty
但 Python 似乎找不到它。
ImportError: No module named pty
在解释器中运行 help('modules')
显示 pty
已安装。
I have Python 2.7 installed on OpenSUSE. I'm using the pty
module to spawn some ptys:
import pty
But Python can't seem to find it.
ImportError: No module named pty
Running help('modules')
in the interpreter shows that pty
is installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重新发布作为答案:
问题很可能是您的 IDE 未正确设置
sys.path
。找到pty
的导入位置,并确保它位于 IDE 设置中的 PYTHONPATH 中。Reposting as an answer:
The problem is likely that your IDE is not setting up
sys.path
correctly. Find wherepty
is imported from, and make sure that's on your PYTHONPATH in your IDE's settings.