Marcus Marcus - 5 months ago 27
Python Question

How to set Python's default version to 3.3 on OS X?

I'm running Mountain Lion and the basic default Python version is 2.7. I downloaded Python 3.3 and want to set it as default.


$ python
version 2.7.5
$ python3.3
version 3.3

How do I set it so that every time I run
$ python
it opens 3.3?


Changing the default python version system wide would break some applications that depend on python2.

You can alias the commands in most shells, Mac OS X uses bash by default, if you also do put this into your ~/.bash_aliases:

alias python='python3'

python command now refers to python3. If you want the original python (that refers to python2), you can escape the alias i.e. doing \python will launch python2 leaving the alias untouched)

If you launch interpreters more often (I do), better is to:

alias 2='python2'
alias 3='python3'

Tip: Instead of doing:

#!/usr/bin/env python


#!/usr/bin/env python3

system will use python3 for running python executables.