I have a Mac which uses MacPorts to have multiple versions of Python installed and use the python_select application to switch between them.

Currently, this Mac has OS 10.6.6, which comes with Python 2.6.1 installed as /usr/bin/python. Using MacPorts, I've installed the python27, python31, and python_select ports and now have this issue: python_select seems to not be switching the default python properly:

$ which python
$ python -V
Python 2.6.1
$ /usr/bin/python -V
Python 2.6.1
$ sudo python_select python27
Selecting version "python27" for python
$ which python
$ ls -l /opt/local/bin/python
lrwxr-xr-x  1 root  admin    24B Mar 18 10:24 /opt/local/bin/python -> /opt/local/bin/python2.7
$ python -V
Python 2.6.1           # <-- Wrong!!!
$ /opt/local/bin/python -V
Python 2.7.1           # <-- Why are you not default?

So, after running python_select, which python seems to think that the /opt/local/bin version is going to be used, but in reality, it seems that the /usr/bin one is taking precedent unless I specifically call the /opt/local/bin one.

Is there something I'm doing wrong?


This question is perfectly answered in the response to a StackOverflow question:

How to make Python select work for python command

| improve this answer | |
  • Thank you! I had an extra PATH append in my bash_profile that was throwing it off. – MidnightLightning Mar 18 '11 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.