PyDev Eclipse (Win7 x64) 中未解决的导入

发布于 2024-12-14 20:08:35 字数 245 浏览 2 评论 0原文

当我尝试导入 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 技术交流群。

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

发布评论

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

评论(3

没有心的人 2024-12-21 20:08:35

通常这是 PYTHONPATH 配置中的问题...

请提供以下详细信息以帮助诊断它:

  1. 您的 PYTHONPATH -- 您可以通过以下方式获取它: import sys;print('\n'.join(sorted( sys.path)))

  2. 安装 Tkinter 的位置。

  3. 显示为未解析的实际代码。

Usually this is a problem in the PYTHONPATH configuration...

Please provide the details below to help diagnose it:

  1. your PYTHONPATH -- you can get it by making: import sys;print('\n'.join(sorted(sys.path)))

  2. The place where Tkinter is installed.

  3. The actual code that's appearing as unresolved.

Saygoodbye 2024-12-21 20:08:35

您是否将 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.

伴我心暖 2024-12-21 20:08:35

我也有类似的问题。确保将库添加到您的 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.

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