PyDev Eclipse (Win7 x64) 中未解决的导入
当我尝试导入 Tkinter 时,Eclipse 抛出未解析的导入。我偶然发现了这个网站:http://klaith.wordpress。 com/2009/06/12/pydev-unresolved-import-errors/ ,但这些提示都没有真正帮助。有什么建议吗?
My Eclipse throws unresolved import when I`m trying to import Tkinter. I stumbled on this site: http://klaith.wordpress.com/2009/06/12/pydev-unresolved-import-errors/ ,but none of those tips did really help. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常这是 PYTHONPATH 配置中的问题...
请提供以下详细信息以帮助诊断它:
您的 PYTHONPATH -- 您可以通过以下方式获取它: import sys;print('\n'.join(sorted( sys.path)))
安装 Tkinter 的位置。
显示为未解析的实际代码。
Usually this is a problem in the PYTHONPATH configuration...
Please provide the details below to help diagnose it:
your PYTHONPATH -- you can get it by making: import sys;print('\n'.join(sorted(sys.path)))
The place where Tkinter is installed.
The actual code that's appearing as unresolved.
您是否将 Tkinter 添加到 pythonpath 中?每当您添加新库时,您都必须更新它。
转到 Window->Preferences->PyDev->Intepreter,在库下添加模块的路径。您可以通过右键单击项目,转到属性并在那里更新它来对项目执行相同的操作,但该 python 路径将仅用于该项目。
Did you add Tkinter to pythonpath? Whenever you add a new library you have to update that.
Go to Window->Preferences->PyDev->Intepreter, under libraries add the path to the module. You could do the same for the project by right clicking on it, going to properties and updating it there, but that python path will only be used for that project.
我也有类似的问题。确保将库添加到您的
PYTHONPATH
后,您可能需要重新启动您的 IDE,错误才会真正消失。我不知道为什么这有效,但它对我有用。I was having a similar problem. After ensuring the library(ies) are added to your
PYTHONPATH
, you may need to restart your IDE before the errors actually disappear. I don't know why that worked, but it did for me.