即使已安装,也无法导入 pty 模块

发布于 2025-01-07 03:07:44 字数 247 浏览 3 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光下慵懒的猫 2025-01-14 03:07:44

重新发布作为答案:

问题很可能是您的 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 where pty is imported from, and make sure that's on your PYTHONPATH in your IDE's settings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文