Upgrade Python in Ubuntu

This article will/shall always be inline for the sole purpose of keeping python up-to-date, and to the latest, greatest stable as always as possible version. We shall strictly speak to Ubuntu here I mean any version 19.10+(Eoan Ermine) at the time of writing and beyond in the upcoming future, however this might also work for Debian, Linux Mint and its derivatives too, but your mileage might vary as per the repositories updated and as maintained by the respective developers out there for certain distros which adhere to Ubuntu and Debian guidelines. Now let us begin.

let us check your current python version:

python -V

or

python --version

Ubuntu 19.10 default output as seen here at the time of writing,
Python 2.7.17rc1

Set your Python Default

Configure the priority for the versions of python that we have installed, 2.7 and 3.X, list here:

ls /usr/bin/python*

Ubuntu 19.10 default output:

To set your version priorities, with 3.7 being the high priority:

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

We’ve just set 3.7 2 to have priority great than 2.7 1. Now, when we list the python priorities we see see 3.7 is higher that 2.7:

update-alternatives --config python

Thus, check your version again and you’re always good to go.

Happy Python-ning ! -;)


Akash Angle

I am a Full time Linux user who has quit using Windows for unknown reasons, making my life truly open source.

Recent Posts

Get the most juice from your ISP/router — setting MTU size & other handy tweaks

This is not an ad-vocation by any means for TP-link branding, however a real life…

7 months ago

How to make any Android phone up-to 3x faster – Developer options unleashed

First of all we need to hit the kernel version on any Android device. You…

7 months ago

systemd-resolve command not found in Ubuntu Desktop

Use resolvectl status instead. It's like something deprecates and suddenly things get broken! In systemd…

12 months ago

How to exclude multiple directories with rsync?

Geeky question: This is what people and friends have tried: rsync -arv --exclude "/home/john/.ccache:/home/ben/build" /home/john…

12 months ago

How to resolve apt-get -f not working

You might encounter this error which appears to be very common on Debian based Distro's…

12 months ago

How to install Broadcom STA wireless drivers on Kali Linux

PS: This article is for only Kali Linux users, that too having a Broadcom Wireless…

1 year ago