MacOS – Problems integrating Python 3.1 on 10.6.5

macospython

I am beginning to learn Python, and want to "upgrade" my Python installation os OS X 10.6.5.

I know it's a bad idea to directly upgrade the Python install, so I have installed Python 3.1 separately from the default Python install (2.6.1).

However, whenever I use the "python" command from the terminal, it starts up Python 2.6.1.

I have tried multiple recommended ways to get the "python" command to start up the newest version, rather then the default:

1) I have tried running the script "Update Shell Profile.command" script in the Applications/Python 3.1 directory, and get the following output:

    This script will update your shell profile when the 'bin' directory
of python is not early enough of the PATH of your shell.
These changes will be effective only in shell windows that you open
after running this script.
All right, you're a python lover already

2) I have created a file named .profile in my home directory, with the following contents:

#### Let's take care of our $PATH
# A backup of the original $PATH
# /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

# My preferred order - /usr/local goes first, damn it!
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin

As recommended here: https://superuser.com/questions/29652/how-do-i-properly-update-python-on-mac-os-x

Neither one changes the effects of the "python" command; it still starts up Python 2.6.1. I can still start Python 3.1 by using the command python3.1, but I'd like to set Python 3.1 to the default for the "python" command.

Best Answer

At least with MacPorts, this is done with the python_select command. It may not be immediately applicable to your setup (you didn't mention MacPorts) but it's somewhere to start.