Take the 2-minute tour ×

I can access Python 3 via python3 command. But I want to make the default interpreter to use python command for Python 3. Simple typing python takes me to Python 2. How to upgrade?

share|improve this question
@soulsource, yeah I'm aware of that. that's why i asked is there an "upgrade" option available or not. –  Giri Jul 17 '13 at 8:24
I think the answer by Radu Rădeanu is already quite close to the optimal solution. It only applies to one user, and is only in effect for directly running python typing the python command, not affecting programs with a #!/usr/bin/python shebang. –  soulsource Jul 17 '13 at 8:44
@soulsource that's what I'm searching for! :) thanks! –  Giri Jul 17 '13 at 9:36

4 Answers 4

up vote 17 down vote accepted

A simple safety way would be to use an alias, by placing:

alias python=python3

into ~/.bashrc or ~/.bash_aliases file.


share|improve this answer
so no "upgrade" option..?? –  Giri Jul 17 '13 at 8:14
@Giri You said that you have python3. What for an upgrade? –  Radu Rădeanu Jul 17 '13 at 8:16



just do the same with python2.7 and python 3.3

share|improve this answer

[Update: This is the wrong way, I have learned, since Python-2 and Python-3 are not really interchangeable.]

You can try the command line tool update-alternatives.

$ sudo update-alternatives --config python




share|improve this answer
python2 and python3 are not alternatives. Do not use update-alternatives for this purpose. –  i08in Jun 2 '14 at 18:37

From the Ubuntu wiki:


What this does not mean:




For CLI use, like @Radu Rădeanu, I would recommend putting an alias in the user's ~/.bashrc, .bash_aliases file (the different files, including ~/.bash_profile, are all loaded together and are simply for organizational purposes).

Such as:

alias python=python3


alias python='/usr/bin/python3'

Scripts can then start with something like:

#!/usr/bin/env python

instead of


I would still recommend using #!/usr/bin/python3 in scripts for simpler cross-compatibility.

share|improve this answer

Your Answer


