Eclipse PyDev 现在将对 Tkinter 的所有引用显示为错误

发布于 2024-09-27 20:27:34 字数 550 浏览 7 评论 0原文

我已经在我的 Python Tkinter 项目中使用 Eclipse 和 PyDev(请注意,在 Windows 上)大约一个月了,直到最近我还没有任何抱怨。我像这样启动一个模块(我的 GUI)的源代码:

from Tkinter import *

现在,自从我将 Eclipse 更新到 3.6.1 后,每次调用 Tkinter 模块(Frame(), <代码>Label()、Tk()等)。我认为更新过程中可能出了问题,所以我卸载了Eclipse,重新下载它(Eclipse 3.6.1 Classic),然后重新安装。然后,看到这给我安装 PyDev 带来了一堆错误,我删除了它,获取了 Eclipse 3.6.0 Classic,安装了它,并遇到了我之前试图修复的相同问题。

我不明白这里出了什么问题。我不明白为什么 Eclipse 会突然停止识别我导入了 Tkinter。

任何人都可以提供任何建议/意见吗?我真的很想坚持使用 Eclipse,我对它非常满意,但我无法处理它给我带来的大约 200 个虚假错误。

I've been using Eclipse with PyDev (on Windows, mind you) for my Python Tkinter project for about a month now, and up until recently I've had no complaints. I start the source for one module (my GUI) like so:

from Tkinter import *

Now, ever since I updated Eclipse to 3.6.1, it shows an error for every call to the Tkinter module(Frame(), Label(), Tk(), etc.). I thought that something might have gone wrong during the update, so I uninstalled Eclipse, re-downloaded it (Eclipse 3.6.1 Classic), and reinstalled it. Then, seeing that that gave me a bunch of errors with installing PyDev, I removed that, got Eclipse 3.6.0 Classic, installed it, and got the same problem I was trying to fix earlier.

I don't understand what's wrong here. It doesn't make any sense to me why all of a sudden Eclipse would stop recognizing that I had imported Tkinter.

Can anyone offer any suggestions/input? I really want to stick with Eclipse, I'm very happy with it, but I can't deal with it giving me about 200 bogus errors.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

以酷 2024-10-04 20:27:34

你真的不应该使用野生进口。请考虑使用 from Tkinter import Frame, Labelimport Tkinter as tk 来代替。

现在解决您的问题:我也有 Eclipse Helios (3.6.0.v20100602)。您描述的问题显然与 PyDev 有关,而不是与 Eclipse 基础项目有关。我刚刚尝试了相同的导入,但没有收到错误消息。例如,我的 PyDev 版本还可以正确检索 Frame 的文档字符串。

我认为这归结为仅安装较新版本的 PyDev(这是许多错误的解决方案 ^^) - 添加“http://pydev.org/nightly”作为更新站点,然后升级到最新版本。顺便说一句,我的版本是 1.6.3.20100922。如果这没有帮助,您应该考虑将其报告为错误。

You really shouldn't use wild imports. Consider from Tkinter import Frame, Label or import Tkinter as tk instead.

Now to your problem: I have Eclipse Helios, too (3.6.0.v20100602). The problem you describe clearly has to do with PyDev, not with the Eclipse base project. I just tried the same import and didn't get error messages. My PyDev version also retrieves the docstring of Frame correctly, for example.

I think it boils to just installing a newer version of PyDev (this is the solution for many bugs ^^) - add "http://pydev.org/nightly" as an update site and then upgrade to the latest version. I have version 1.6.3.20100922, by the way. If that doesn't help, you should consider reporting it as a bug.

任性一次 2024-10-04 20:27:34

我发现此类问题的答案通常是您必须从 eclipse 更新您的 pythonpath。请参阅我的答案类似的问题。我认为重新安装 pydev 和/或 eclipse 通常可以解决这个问题,因为这样做会重新配置 pythonpath。

I find the answer to problems like this is usually that you have to update your pythonpath from eclipse. See my answer to a similar question. I think re-installing pydev and/or eclipse usually solves this problem because in doing so, the pythonpath is re-configured.

如果没结果 2024-10-04 20:27:34

您使用哪个 Python 版本?如果> 3.1 尝试(注意小写书写):

from tkinter import *

Which Python version do You use? If > 3.1 try (note lowercase writing):

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