I installed python 2.7.3 via brew,but virtualenv always use 2.7.1,why?

1.4k Views Asked by At

The system default python is:

$ /usr/bin/python --version
Python 2.7.1

my $PATH is

export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin

I installed python 2.7.3 via homebrew,

$ brew install python --universal --framework

and linked it,

$ cd /System/Library/Frameworks/Python.framework/Versions
$ sudo mv Current _Current
$ sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current

but when I make a virtualenv, it's still 2.7.1

$ python --version
Python 2.7.3

$ virtualenv venv
$ cd venv;source bin/activate
(venv) $ python --version
Python 2.7.1

How to solve it?

1

There are 1 best solutions below

0
On BEST ANSWER

From virtualenv's help message:

 -p PYTHON_EXE, --python=PYTHON_EXE
                        The Python interpreter to use, e.g.,
                        --python=python2.5 will use the python2.5 interpreter
                        to create the new environment.  The default is the
                        interpreter that virtualenv was installed with

You probably installed virtualenv with Python 2.7.1 and it works as designed. You can use the -p option to use another version in your virtual env.