I'm using Debian 7.5, and I've installed Python 3.3 and 3.2. How do I make 3.3 the default for when someone types python in the command line?

1 Answer 1


To change the version of python that is executed when you type python on the command line, and only then, define an alias in your shell initialization file (the one for interactive shells). This is ~/.bashrc for bash, ~/.zshrc for zsh, ~/.cshrc for csh, ~/.config/fish/config.fish for fish. Use the correct path for Python 3.3 for your installation.

alias python='/usr/local/bin/python3.3'

If you want this to work for all users, you can put it in a system-wide file; however I don't recommend it, because this causes python typed on the command line to be a different version from python executed from a script or any other place, which is confusing.

In Debian wheezy, python in the default search path should be Python 2.7, because there are programs that depend on it (several packages ship Python 2 scripts that have #!/usr/bin/env python as their shebang line). If you want, you can change the system default for Python 3 to be Python 3.3 instead of the 3.2 that ships with Debian wheezy. To do that, create a symbolic link in /usr/local/bin (you'll need to be root to do this). If you installed Python 3 in directly in /usr/local:

ln -s python3.3 /usr/local/bin/python3

If you installed it somewhere else:

ln -s /path/to/python3.3/bin/python3.3 /usr/local/bin/python3

Scripts that ship with Debian with the shebang #!/usr/bin/python3 will keep using 3.2, but scripts that use #!/usr/bin/env python3 will now use 3.3, and typing python3 on the command line will invoke 3.3.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .