简体   繁体   中英

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.

So, I run python setup.py install for a package and there are being installed in python2.7 site packages. Note, the package I install in in-turn runs easy_install to install dependancies.

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?

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. And when you want start your application from virtualenv you could:

/virtualenv/bin/python your_project.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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