Thursday, June 11, 2026
HomeLanguagesSetting python3 as Default in Linux

Setting python3 as Default in Linux

Python 2 support ended on 1-January-2020, and many major projects already signed the Python 3 Statement that declares that they will remove Python 2 support. However many of us prefer to code on python interpreter for tiny code snippets, instead of making .py files. And when we fire command ‘python’ on the terminal, interpreter of python2 gets launched by default. 
 

python2 launching default in Linux

Which leaves us with no choice other than, explicitly typing python3. However, we can set python3 as default by firing two commands on terminal

echo "alias python='python3'" >> .bashrc
source .bashrc

Now if we check in the terminal by just running the “python” command it would result in the following:

Setting python3 as Default in Linux

The interpreter of python 3 was launched, rather than an interpreter of python2. We basically wrote a permanent alias in .bashrc, which replaces command python as python3 and we reloaded the .bashrc file.

RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS