使用 PyDev 和 Virtualenv 设置 Eclipse Juno
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13617956/
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
Setting up Eclipse Juno with PyDev and Virtualenv
提问by danielrvt
I have managed to set up the python interpreter of my pydev installation to the one in my virtualenv folder following this steps:
按照以下步骤,我设法将我的 pydev 安装的 python 解释器设置为我的 virtualenv 文件夹中的那个:
- MyProject -> Properties -> PyDev - Interpreter/Grammar
- Click on "Click here to configure an interpreter not listed"
- In the section "Python Interpreters" -> new -> Browse -> Select my virtualenv interpreter
- Select the new interpreter as the default one clicking in the up button with the interpreter selected.
- MyProject -> 属性 -> PyDev - 解释器/语法
- 单击“单击此处配置未列出的解释器”
- 在“Python 解释器”部分 -> 新建 -> 浏览 -> 选择我的 virtualenv 解释器
- 选择新的解释器作为默认解释器,在选中解释器的情况下单击向上按钮。
Yei! everything works nice! but... When I use any library installed via pip, my eclipse shows an error mark in the editor, its very annoying because everything works fine!
耶!一切正常!但是...当我使用通过 pip 安装的任何库时,我的 Eclipse 在编辑器中显示一个错误标记,这很烦人,因为一切正常!
I'm thinking of not using PyDev just because of this little detail... Does anyone know a way to solve this?
我正在考虑不使用 PyDev 只是因为这个小细节......有没有人知道解决这个问题的方法?
采纳答案by Fabio Zadrozny
There's a little tutorial explaining about it at:
有一个小教程解释它:
http://pydev.blogspot.com.br/2010/04/pydev-and-virtualenv.html
http://pydev.blogspot.com.br/2010/04/pydev-and-virtualenv.html
I believe your problem is explained there... (i.e.: after installing something you must restore your interpreter info).
我相信你的问题在那里得到了解释......(即:安装某些东西后,你必须恢复你的解释器信息)。
回答by Florent
In Preferences/ PyDev/ Interpreters/ Python Interpreter, go to the Libraries tab and add a new folder for the site-packages
folder where your virtualenv
packages are installed.
在 Preferences/PyDev/Interpreters/Python Interpreter 中,转到 Libraries 选项卡并为安装包的site-packages
文件夹添加一个新文件夹virtualenv
。