add-semi-colons
add-semi-colons

Reputation: 18830

Why virtualenv doesn't have same python version

I use macports to keep my software up to date, In macports my python version is 2.7.5, I create my virtualenv and then check the python --version of the newly created virtual environment and the python version is 2.6.1. Based on my understanding virtualenv should have the same python version since I created it from 2.7.5.

when I do which python I get the correction location which is the location that macports installs its software packages.

~/code]$python --version
Python 2.7.5
~/code]$which python
/opt/local/bin/python

What would be the reason virtualenv to have different python --version.

Upvotes: 0

Views: 141

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174708

virtualenv was installed against the system Python and not the macports version. To use the the macports version of Python, pass it in as a parameter:

virtualenv --python=/opt/local/bin/python

If you want to make this permanent, set the VIRTUALENV_PYTHON variable in your shell and point it to the Python from macports:

$ export VIRTUALENV_PYTHON=/opt/local/bin/python
$ virtualenv new_venv

You could also uninstall the existing virtualenv library and install the one from macports:

port select --list virtualenv
port select --set virtualenv virtualenv27
which virtualenv

Upvotes: 1

Related Questions