如何让 Eclipse Pydev 插件识别新安装的 Python 模块?
所以我刚刚安装了 SubnetTree (http://www.icir.org/robin/pysubnettree/ ),如果我打开 Python 交互式解释器,我可以成功导入它,而不会出现任何错误消息。我在我的一个程序中使用它,并且可以顺利运行它。但是,Eclipse 将导入标记为错误,这是我使用 Eclipse 进行调试时的问题。我已经进入首选项并恢复了我正在使用的Python解释器,但没有效果。我只能恢复Python解释器退出,并在我的另一台机器(OS X 10.5,我现在使用OS X 10.6)上重新打开它,并且它很好地识别了SubnetTree。知道我应该怎么做吗?提前致谢。
So I just installed SubnetTree (http://www.icir.org/robin/pysubnettree/) and if I open the Python interactive interpreter I can successfully import it without any error messages. I use it in one of my programs and can successfully run it without a hitch. However, Eclipse marks the import as an error, and this is a problem as I use Eclipse for debugging. I have gone to preferences and have restored the Python interpreter I am using to no avail. I was able to merely restore the Python interpreter exit, and reopen it on my other machine(OS X 10.5, I am now using OS X 10.6) and it identified SubnetTree just fine. Any idea of how I should go about this? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您已经尝试“刷新”解释器的
PYTHONPATH
(在 Eclipse 的 Pydev Python 解释器配置中)并且它不起作用,您可以尝试从列表中删除解释器并再次创建它。执行此操作时,您应该正确加载所有模块,即使是缺少的新模块。if you already tried "refreshing" your interpreter's
PYTHONPATH
(in Eclipse's Pydev Python interpreter configuration) and it didn't work you could try deleting the interpreter from the list and creating it again. When doing this, you should get all your modules loaded correctly, even the missing new modules.PyDev 版本 3.6,在 Eclipse 首选项 -> PyDev->口译员首选项窗格提供了一个标记为“检查口译员是否与环境同步”的按钮。在我的 mac 和 Eclipse Luna 上,单击此按钮会触发一些幕后魔法,解决了 PyDev 没有注意到 PeeWee 新安装的问题。我在 Eclipse 主窗口的右下角看到一条消息“Synch System PYTHONPATH”短暂闪烁。我没有删除或重新添加解释器(Python 2.7),重新启动 Eclipse 也没有解决问题;但点击这个按钮却做到了。
PyDev version 3.6, on the Eclipse Preferences -> PyDev -> Interpreters preferences pane, offers a button labeled "Check if interpreters are synchronized with environment". On my mac and Eclipse Luna, clicking on this button triggered some behind-the-scenes magic that solved my problem of PyDev not noticing a new installation of PeeWee. I saw a message flash briefly in the lower-right corner of the main Eclipse window "Synch System PYTHONPATH." I did not remove nor re-add the interpreter (Python 2.7), restarting Eclipse did not solve the problem either; but clicking this button did.
是的 - 它有效!我已经被这个问题困住了三天了。转到“项目”、“属性”、“PyDev - 解释器/语法”,“单击此处配置未列出的解释器”,突出显示 &删除 python (C:/Python27\Python.exe)、自动配置(显示下面的列表,您可以根据需要查看并选中该列表),然后单击“确定”。
Yes - it works! I've been stuck on this for three days. Go to Project, Properties, PyDev - Interpreter/Grammar, "Click here to configure an interpreter not listed", highlight & Remove python (C:/Python27\Python.exe), Auto Configure (brings up a list below that you can review and checkmark as needed), then click on OK.