I want to learn Python using my Mac.

Now I want to setup a Python version >= 3.1.3, because my materials for learning are using this version.

Typing python into terminal results version 2.6.1, using the dmg installer on python.org doesn't have an effect on the python version in terminal, but it's bundled with an own shell under Applications/Python 3.1/Idle.app

Should I use this shell for learing or is there a better way, updating the Python version bundled with Snow Leopard?

I already tried defaults write com.apple.versioner.python Version 3.1.3 or defaults write com.apple.versioner.python Version 3.0 without any result.

up vote 2 down vote accepted

Python 3 breaks things. That's why it doesn't replace Python 2, and python still launches 2.

To get Python 3, type python3. You might need to change your $PATH by editing ~/.bash_profile and adding:

export PATH

You could define a shell function or alias to map python to python3, this way old scripts would continue to run, and you can type python and get version 3.

Add to .bash_profile:

alias python='python3'

/usr/bin/env python continues to provide Python 2.

You don't really want to change th default, as the syntax is different enough that apps that require python 2.x will break under 3.

I think that if you type python3 instead of python then it will uses version 3 ( or maybe I just set mine up like that!)

Using IDLE is just fine for learning Python. You can either save files with your code or run individual lines of code from the shell.

If you want, you can use text editors such as TextMate or an IDE such as Eclipse with your Mac install of Python 3.1. You just need to point those applications to the location of the Python interpreter.

I did the following post on setting up TextMate with Python 3 in this way. Hope it helps.

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.