vote up 4 vote down star
3

I recently upgraded my Mac OS X 10.5 Leopard install to 10.6 Snow Leopard, and with that came an upgraded version of Python, 2.6.1 (instead if 2.5.1). Now when I type python in the Terminal i still get

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

I looked in /usr/bin/ and found that to get Python 2.6 I have to type python2.6.

The question is: How do I make the python command map to Python 2.6?

flag

2 Answers

vote up 2 vote down check

It’s easy:

defaults write com.apple.versioner.python Version 2.6

See man python for a complete explanation from Apple.

Also, one gotcha: make sure you are running the Python that came with your computer and not some other one that you installed. Do this by typing which python at your command prompt. It should point to /usr/bin/python. I only mention this because my default is 2.6 under Snow Leopard (it was 2.5 when I was using Leopard). So the fact that you are getting 2.5 may indicate that there’s something else in your path.

link|flag
1  
You were right. I had a long time ago installed MacPython and that screwed up my PATH variable so python pointed to /Library/Frameworks/Python.framework/Versions/Current/bin. Naturally that didn't get upgraded to 2.6. So I replaced my PATH variable with the default one I found on Google, and will now remove MacPython from my system. – SBSTN Sep 4 at 10:14
vote up 0 vote down

Assuming you're using bash, type:

% type -a python

That will show you all "python" executables, aliases, shell builtins (likely none) or bash functions in your PATH.

This should help you better identify what's going on here.

link|flag

Your Answer

Get an OpenID
or
never shown

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