Reputation: 90
I created a virtualenv and installed some packages with pip. I want to use Python 2.7, which is the default version on my system. The env's lib folder contains a folder for Python 2.6, not 2.7. Why is it not using 2.7, and how can I correct it?
$ python -V
Python 2.7.6
$ virtualenv flask
flask/
bin/
app/
lib/
Python2.6/
Upvotes: 1
Views: 1775
Reputation: 11309
Find where python2.7 is, then tell virtualenv to use that binary.
$ which python2.7
/usr/bin/python2.7
$ virtualenv -p $(which python2.7) flask
For example, on Ubuntu, install virtualenv with sudo apt-get install virtualenv
. Create an env with virtualenv vpy
. This creates a vpy
directory. Next run . ./vpy/bin/activate
to activate the env. Install packages with pip like pip install flask
.
Every time you start a new shell, you must activate the env again with . ./vpy/bin/activate
.
Upvotes: 3