本文介绍了PyDev错误与进口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PyDev / Eclipse来处理几个monthes,并且与进口有一样的错误:
PyDev在红色中下划线,并说 Unresolved import xxx;在yyy找到。当我点击 yyy eclispe查找并打开模块的实现。
(PyDev只是通知我,它找不到模块xxx,并在同一个消息,它可以找到它!)



模块 xxx 在日食的PYTHONPATH中。当我探索该项目的口译员时,我可以找到没有任何问题。
当我尝试执行(从eclipse),我没有得到任何错误,它的工作正常。



有时,错误消息将保留几个日子会消失。有时,不会。我试图刷新项目,但并没有影响。
有时候,它在一个项目上运行良好,我可以使用自动完成,它不能在另一个项目中工作(同一个翻译)...



我只是不明白发生了什么?



到目前为止,我已经忽略了这些错误,因为一切都是完全启发的,但有时候,有一些令人不安的红色标记错误当你工作的时候。



你有没有办法在PyDev中避免这些错误?是正常吗?有没有办法强制PyDev刷新?



谢谢。



参考文献:




  • python 2.4.4(源自内置)

  • PyDev v 1.6.0 2010071813


解决方案

如果新模块没有被PyDev缓存,这可能会发生。例如,在我的新笔记本电脑上,我首先设置了PyDev / Eclipse,然后安装了Django软件包。这就是为什么Django进口被标记为未解决的原因。您可以使用Pydev> Interpreter - Python> Libraries> Apply来刷新它。选择您要恢复的解释器(他们可以选择一个更好的词),然后单击确定。 PyDev然后将重新排列所有已安装的模块。



我正在使用每夜的PyDev版本,但任何1.6.x版本都应该正常工作。如果没有帮助,请删除解释器配置并创建一个新的。


I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports:PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module.(PyDev just inform me that it can't find the module xxx and in the same message that it can find it !)

The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems.When I try to execute (from eclipse), I don't get any error and it works fine.

Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that.Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ...

I just can't understand what is happenning ?

So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working.

Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ?

Thank you.

References :

  • python 2.4.4 (built from sources)
  • PyDev v 1.6.0 2010071813

解决方案

This can happen if new modules are not cached by PyDev. For example, on my new laptop I first set up PyDev/Eclipse and later installed the Django package. That's why Django imports were marked as unresolved. You can refresh it using Pydev > Interpreter - Python > Libraries > Apply. Select the interpreter you want to "restore" (they could have chosen a better word) and click OK. PyDev will then reparse all installed modules.

I'm using the nightly version of PyDev, but any 1.6.x version should work correctly. If that doesn't help, remove the interpreter configure and create a new one.

这篇关于PyDev错误与进口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 19:17