Posts Set default Python version to Python3
Post
Cancel

Set default Python version to Python3

A lot of us out there face issues while trying to point latest Python version as default. If you are facing issues while trying to install latest Python3 in your Ubuntu PC , but every attempt to change the default python version is in vain ?

I had to try a number of trial an error options before finally finding a simple solution for this.

Follow below simple steps and this should get your linux machine python installation default to Python3.

Assuming your current version is Python2, say Python 2.7 . And you have already performed Python3 installation, say Python 3.7

Add Python2.7 & Python 3.7 to update-alternatives

1
2
sudo update-alternatives --install /usr/bin/python2 python2 /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

Update Python3 to point to Python 3.7

1
sudo update-alternatives --config python3

Enter 2 for Python 3.7

Test the version of python

1
python --version

Did this post help you with your issue ? Please leave your comments below.

This post is licensed under CC BY 4.0 by the author.

How to add Disqus comments to Jekyll Blog

Autosys - How to prevent multiple jobs from running at the same time

Comments powered by Disqus.