2

I have installed python via mac ports, using:

sudo port install python33

I then did:

sudo port select --set python python33

and got:

Selecting 'python33' for 'python' succeeded. 'python33' is now active.

However when I do which python I get:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python

and for which python3 I get:

/Library/Frameworks/Python.framework/Versions/3.1/bin/python3

What have I done wrong?

When I do: port select --list python

I get:

Available versions for python:
    none
    python25-apple
    python33 (active)

When I do type -a python, I get:

python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /opt/local/bin/python
python is /usr/bin/python
python is /usr/local/bin/python

When I type: echo $PATH, I get:

/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.1/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/X11R6/bin
1

which looks on the path to find the first python that it can find. port select changes /opt/local/bin/python to call the chosen python. For this to work /opt/local/bin has to be on the path before any other directory that contains python.

In your case you have /Library/Frameworks/Python.framework/Versions/2.7/bin and /Library/Frameworks/Python.framework/Versions/3.1/bin before /opt/local/bin.

You need to clean up your path. I would suggest starting from scratch and only adding directories that you know and understand. You seem to have installed python in many ways and also have installed fink and macports. I would only use one of the package managers and remove all the explicit pythons from the path.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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