Eclipse 和 python:库将在 interprer 中导入,但不会在 IDE 中导入
我正在运行 Windows 7、Python 2.6.4 和最新版本的 Eclipse。我下载了 boto 库 (http://code.google.com/p/boto/)并运行 python setup.py install,这在 C:\Python26\Lib\site-packages 中创建了 boto-1.9b-py2.6.egg。
导入类 - 例如,通过执行“from boto.sqs.connection import SQSConnection” - 从 python 命令行工具可以正常工作。但是 Eclipse 不会找到 boto,尽管它使用与我在命令行时使用的相同的 python 解释器。我将库添加为外部源文件夹,但这也不起作用。如何正确地将 boto 库导入到 Eclipse 中?
谢谢。
I'm running Windows 7, Python 2.6.4 and the latest version of Eclipse. I downloaded the boto library (http://code.google.com/p/boto/) and ran python setup.py install, which created boto-1.9b-py2.6.egg in C:\Python26\Lib\site-packages.
Importing a class - say, by doing 'from boto.sqs.connection import SQSConnection' - works fine from the python command line tool. But Eclipse will not find boto, despite the fact that it is using the same python interpreter as I am using when at the command line. I added the library as an external source folder, but that didn't work either. How can I properly import the boto library into Eclipse?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从评论中可以将其标记为已回答
在 Preferences->Pydev->interpreter - Python 中 System libs 值是什么
From the comment so can be marked as answered
In Preferences->Pydev->interpreter - Python what is the System libs value
对于仅在单个项目中需要的库,最佳实践是将它们添加到项目的 PYTHONPATH 而不是 SYSTEM PYTHONPATH。
这是通过右键单击项目 -> 来完成的属性-> PyDev-PYTHONPATH ->外部库,然后使用 Add zip/jar/egg 添加所需的库。
For libraries that are required only in a single project, the best practice is to add them to the Project's PYTHONPATH and not the SYSTEM PYTHONPATH.
This is done by right clicking on the project -> Properties -> PyDev-PYTHONPATH -> External Libraries and then adding the required library using Add zip/jar/egg.