简体   繁体   English

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

[英]Can't import pty module even though it's installed

I have Python 2.7 installed on OpenSUSE. 我在OpenSUSE上安装了Python 2.7。 I'm using the pty module to spawn some ptys: 我正在使用pty模块生成一些pty:

import pty

But Python can't seem to find it. 但是Python似乎找不到它。

ImportError: No module named pty

Running help('modules') in the interpreter shows that pty is installed. 在解释器中运行help('modules')表示已安装pty

Reposting as an answer: 重新发布作为答案:

The problem is likely that your IDE is not setting up sys.path correctly. 该问题可能是您的IDE无法正确设置sys.path Find where pty is imported from, and make sure that's on your PYTHONPATH in your IDE's settings. 找到从哪里导入pty ,并确保它在IDE设置中的PYTHONPATH上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM