Python läuft über Mac-Ports

2169
Baz

Ich habe Python über Mac-Ports installiert.

sudo port install python33 

Ich habe dann gemacht:

sudo port select --set python python33 

und bekam:

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

Wenn ich jedoch which pythonbekomme:

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

und dafür which python3bekomme ich:

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

Was habe ich falsch gemacht?

Wenn ich tue: port select --list python

Ich bekomme:

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

Wenn ich das tue type -a python, bekomme ich:

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 

Wenn ich folgendes eingebe: echo $ PATH, bekomme ich:

/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 
2

1 Antwort auf die Frage

1
Mark

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.