Posts Set default Python version to Python3

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

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

sudo update-alternatives --config python3

Enter 2 for Python 3.7

Test the version of python

python --version

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

Tags :
Hi, I’m Aslam. I work as a Software Consultant for an US based software service company. Performing the role of a lead developer and application support engineer in Markit Enterprise Data Management tool for an UK based leading Asset Management Company. Currently based at Edinburgh, United Kingdom. Previously, worked as a RoR developer at Foradian. I maintain this blog as a hobby to keep my passion for web technology alive while Iam not busy with my day job. Articles here are mostly about the topics that interest me and that I research. Tweet to me at @tweeslam.


Comments powered by Disqus.

Recent Update


Search Results