简体   繁体   English

虚拟环境设置为python 2.6,但尚未在2.7中安装软件包

[英]virtual enviroment is set to python 2.6 but yet installing packages in 2.7

I used the following to create my virtual environment. 我使用以下内容创建了我的虚拟环境。

mkvirtualenv myenv --no-site-packages -p /usr/bin/python2.6

When I am in the virtual environment I can see that I am using python2.6 even though the default for the system is 2.7 on ubuntu 11.10. 在虚拟环境中时,即使在ubuntu 11.10上系统的默认值为2.7,我仍可以看到我正在使用python2.6。

So, I run python setup.py install for a package and there are being installed in python2.7 site packages. 因此,我为软件包运行python setup.py install,并且正在python2.7站点软件包中进行安装。 Note, the package I install in in-turn runs easy_install to install dependancies. 注意,我依次安装的软件包运行easy_install来安装依赖关系。

eg 例如

Using /usr/lib/pymodules/python2.7
Searching for nltk==2.0.1
Best match: nltk 2.0.1
Processing nltk-2.0.1-py2.7.egg
nltk 2.0.1 is already the active version in easy-install.pth

How do I create a pure virtual environment for python? 如何为python创建纯虚拟环境?

If you use active script and its doesnt work properly. 如果您使用活动脚本并且它无法正常工作。 Try to install packages directly, like: 尝试直接安装软件包,例如:

/virtualenv/bin/pip install package

This is a 100% nice work solution. 这是100%不错的工作解决方案。 And when you want start your application from virtualenv you could: 当您要从virtualenv启动应用程序时,您可以:

/virtualenv/bin/python your_project.py

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

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