eclipse pydev安装后找不到python库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3610272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:04:03  来源:igfitidea点击:

pydev doesn't find python library after installation

pythoneclipsepydev

提问by Raoul Duke

I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py installand it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it.

我正在使用 Django 和 PyDev/Eclipse。我刚刚安装了 django-treebeardsetup.py install并将它安装在我的 site-packages 目录中C:\Python26\Lib\site-packages。我可以使用import treebeard. 但是 PyDev 抱怨当我尝试导入它时它无法解决它。

Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing?

不幸的是,我没有使用 PyDev 的经验,我认为它会自动获取 site-packages 目录中的所有内容,但显然它没有。我错过了什么?

thanks

谢谢

回答by Jochen Ritzel

Pydev doesn't automatically rescan the site-packages folder. You need to go to Preferences-> Interpreter -> Pythonand click apply to make it scan again.

Pydev 不会自动重新扫描 site-packages 文件夹。您需要转到Preferences-> Interpreter -> Python并单击应用以使其再次扫描。

回答by Jay

I also faced the same error when i had installed a new package.i'm using eclipse Helios. Even after applying and re scanning the folder it was NOT detecting the new packages. So finally i clicked on the "Click here to configure a interpreter not listed" listed and deleted the already selected interpreter and used the autoconfig to add the interpreter again. Finally i was able to resolve the issue.

我在安装新包时也遇到了同样的错误。我正在使用 eclipse Helios。即使在应用并重新扫描文件夹后,它也没有检测到新包。所以最后我点击了列出的“单击此处配置未列出的解释器”并删除了已经选择的解释器并使用自动配置再次添加解释器。最后我能够解决这个问题。

回答by powlo

I've found that closing the project and reopening (after rescanning the interpreter) works for me.

我发现关闭项目并重新打开(重新扫描解释器后)对我有用。

回答by lfvv

Well, I followed this sequence to make it work:

好吧,我按照这个顺序使它工作:

1) I installed the desired library by using pip install 2) I went in Eclipse to: Window --> Preferences --> Pydev --> Interpreters --> Python Interpreter, and clicked "Quick Auto-Config". It made the trick.

1) 我使用 pip install 安装了所需的库 2) 我在 Eclipse 中进入:Window --> Preferences --> Pydev --> Interpreters --> Python Interpreter,然后单击“Quick Auto-Config”。它成功了。