简体   繁体   中英

Specify Python version in virtualenv

I am attempting to create a virtual environment that uses Python 2.7.11 (rather than Ubuntu's 2.7.6). I can successfully create the virtual environment using the following code:

virtualenv -p /home/stmist/opt/Python-2.7.11/bin/python2.7 ~/test

However, running the following code:

source ~/test/bin/activate
python -V

indicates that the virtual environment is running 2.7.6. Any suggestions?

Update:

When inside the virtual environment, "pip" modifies packages for 2.7.11, not 2.7.6. I can run Python 2.7.11 using /home/stmist/opt/Python-2.7.11/bin/python2.7. So, the virtual environment is usable, but not ideal.

After restarting my computer, the virtual environment is now using Python 2.7.11. I don't know whether this is due to the restart, or something else along the way. Thanks to everyone for your help.

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