简体   繁体   English

将python虚拟环境链接到eclipse

[英]Linking python virtual environment to eclipse

I have Python2.7 installed and Python3.5 installed on my windows machine.These are at locations C:\\Python27 and C:\\Python35-32. 我在Windows Python3.5安装了Python2.7Python3.5 ,它们分别位于C:\\ Python27和C:\\ Python35-32位置。 Both these are added in System Path environment variables and can be accessed from any directory. 这两个都添加在系统路径环境变量中,并且可以从任何目录访问。

Now i create a virtualenv in Python35-32 directory successfully under a sub-directory CODING_LABS. 现在,我在子目录CODING_LABS下成功在Python35-32目录中创建了virtualenv I try to link/point my Eclipse python interpreter to the python.exe file contained in CODING_LABS. 我尝试将Eclipse python解释器链接/指向到CODING_LABS中包含的python.exe文件。 This is done OK. 这样就可以了。

However, when i run my script from eclipse,it still points to Python27.Unable to figure out why? 但是,当我从eclipse运行脚本时,它仍然指向Python27。无法弄清楚为什么?

Not sure... by default, any run will get the 'default' interpreter (which is the first interpreter in Preferences > PyDev > Interpreters > Python interpreter -- you may reorder those using the up/down button in that screen). 不确定...默认情况下,任何运行都将获得“默认”解释器(这是“首选项”>“ PyDev”>“解释器”>“ Python解释器”中的第一个解释器-您可以使用该屏幕中的向上/向下按钮对它们进行重新排序)。

Now, that's the default, you may also configure to use a different interpreter per project (select project > alt+Enter for its properties > PyDev - Interpreter/Grammar > Interpreter). 现在,这是默认设置,您还可以配置为每个项目使用不同的解释器(选择项目> alt + Enter作为其属性> PyDev-解释器/语法>解释器)。

Or you can choose a different one per launch: Menu > Run > Run Configurations > Select launch > Interpreter. 或者,您可以为每次启动选择其他选项:菜单>运行>运行配置>选择启动>解释器。

Also, you may want to double check to make sure that the paths in the interpreter configuration window (Preferences > PyDev > Interpreters > Python interpreter > select interpreter) actually map to the proper site-packages/external libs you expect. 另外,您可能需要仔细检查以确保解释器配置窗口(“首选项”>“ PyDev”>“解释器”>“ Python解释器”>“选择解释器”)中的路径实际映射到您期望的适当站点包/外部库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM