I am on MacOSx 10.6.8 and I have python 2.7 installed
python -v produces:
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
I them run:
$ virtualenv venv
and then
$ . venv/bin/activate
and do a python -v
and I get:
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Users/nkhdev/venv/lib/python2.6/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /Users/nkhdev/venv/lib/python2.6/lib-dynload/readline.so
Can someone tell me the steps to use have virtualenv create and use python 2.7 from my system? Or have virtualenv, use python 2.7 period. I don't care if the version is my system version.
I had a similar problem, virtualenv python was picking up the 2.7.6 system python from
/usr/bin/python
rather than the 2.7.9 version in/usr/local/bin/python
I had to do:
Then I installed setuptools like so:
Then I installed pip with that new version of setuptools like so:
Then I installed virtualenv
My guess is that both pip and virtualenv are from the 2.6 distro. You can check which one the system users with
which pip
. If you do have other pip/virtualenv install (usewhich -a pip
to find all of them) it might be that you need to tweak yourPATH
environment variable.Another thing to note is the installed Python scripts usually have full path to the Python executable. You can see which python pip is using by running
head $(which pip)
You probably used an existing, Apple-supplied version of
easy_install
to installpip
et al. By default,easy_install
is associated with a particular instance of Python, in this case, the Apple-supplied system Python 2.6. In general, when you install a new version of Python, you need to also install a neweasy_install
for it. Follow the instructions here for the Distribute package which provideseasy_install
, then use it to installpip
and use thatpip
to installvirtualenv
.