Python version issues

Posted by MidnightLightning on Server Fault See other posts from Server Fault or by MidnightLightning
Published on 2011-03-18T15:30:11Z Indexed on 2011/03/18 16:11 UTC
Read the original article Hit count: 1242

Filed under:
|

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
/usr/bin/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
/opt/local/bin/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?

© Server Fault or respective owner

Related posts about python

Related posts about macports