PyDev不承认导入 [英] PyDev does not recognize imports

查看:122
本文介绍了PyDev不承认导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PyDev作为Eclipse,并显示一些红色的下划线作为导入错误的错误。但是,这些进口工作。我可以用F9启动脚本,并且使用这些模块中的类可以正常使用。红线打扰了我,加上我不能使用这些导入的自动完成。我如何强制Eclipse PyDev重新评估项目中的模块?

I am using PyDev for Eclipse, and shows a few red underlines as erros for wrong imports. However, these imports work. I can start the script with F9, and use the Classes from these modules just fine. The red line is bothering me however, plus I cannot use the autocomplete for these imports. How can I force Eclipse PyDev to reevaluate the modules in the project?

我已经将 PYTHONPATH python27 / site_packages 中。

正确导入下方的红色下划线示例:

Example of red underlines under correct imports:

模块 PerClustering.py 存在:

模块 PerClustering.py 包含一个类 PerClustering

其他导入不显示红线。但是,这些模块位于相同的目录中(或实际上是命名空间,因为目录包含一个空的 __ init __。py 文件)

The other imports do not show red lines. These modules are however in the same directories (or actually namespaces, since the directories contain an empty __init__.py file).

推荐答案

假设这段代码可以在其他地方工作,而目录正在进行中,你可能只需要重新构建eclipse项目。要实现此目的,请导航到 Project >> Clean 下的重建选项。

Assuming this code works elsewhere and the directory is in tact, you probably just have to rebuild which is pretty common with eclipse projects. To achieve this, navigate to the rebuild option under Project >> Clean.

编辑:不太可能,但您可能必须重新启动eclipse才能使其工作。

It is unlikely, but you may have to restart eclipse in order to make it work.

这篇关于PyDev不承认导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆