How to change which Python version gets used in Snow Leopard?
I don't know how this will affect other usage† of Python in OS X, but as currently the OS X Python is listed in your PATH
, you just need to change that:
- For use in Finder, see Change Path for OS X (to allow for double-clicking files).
- For use in Terminal, see Where does $PATH get set in OS X 10.6 Snow Leopard?
I don't know if it matters, but just for the archives: on my OS X 10.6 (which is an upgrade from 10.4 via 10.5), /Library/Frameworks/Python.framework/Versions/2.6/bin/
is not listed in PATH
. Instead, which python
yields /usr/bin/python
.
† For example: file /usr/bin/xattr
yields /usr/bin/xattr: python script text executable
, and hence might be affected by changing the Python executable!
Related videos on Youtube
coffee
Updated on September 17, 2022Comments
-
coffee over 1 year
Snow Leopard comes packaged with a version of Python 2.6 that is incompatible with many popular libraries, so I've downloaded a version of Python 2.6 from python.org. However, when I type
python
at the terminal, I still get the old version of Python. How can I change this?which python
currently gives me/Library/Frameworks/Python.framework/Versions/2.6/bin/python
ls -l /usr/bin/python
is not a symbolic link to the above (nor toVersions/Current
).I have a version at
/opt/local/bin/python2.6
that I wish to be using.-
Arjan over 13 yearsMy Snow Leopard shows
python --version
to bePython 2.6.1
. What version are you trying to install? I also wonder if somehow changing this would also affect commands like xattr, for whichfile /usr/bin/xattr
yields/usr/bin/xattr: python script text executable
? -
coffee over 13 yearsI have a version at "opt/local/bin/python2.6" that I wish to be using. I am unsure as to how that would affect commands like xattr, though..
-
Arjan over 13 yearsIs
/Library/Frameworks/Python.framework/Versions/2.6/bin/
listed in your PATH? Like shown byecho $PATH
(If yes, then changing the PATH might suffice for you.) -
Arjan over 13 years
-
-
coffee over 13 yearsAh! So looking at ~/.profile, it seems that Macports added that folder to my path. I commented that out, and it is pointing to the correct python version now. Thanks again for all of your help, Arjan.
-
Arjan over 13 years@coffee, what do you mean by "the correct python version"? Taking it out of the PATH will make OS X use
/usr/bin/python
, not your new/opt/local/bin/python2.6
, right? -
coffee over 13 yearsnope, it's using the one in /opt/local/bin/... I'm assuming that is listed earlier on the path.