How to install python 2.7 or 3.5 or 3.6 on Ubuntu

Ubuntu 18.04 as well as Ubuntu 17.10 come with Python 3.6 pre-installed, which is not the case for older Ubuntu versions. In this article, we will explain how to install latest Python 3.6 in Ubuntu 14.04, 16.04, 16.10 and 17.04.

Ubuntu 14.04 & 16.04

Ubuntu 14.04 and 16.04 ship in with Python 2.7 and Python 3.5. To install latest Python 3.6 version, we need to use PPA “deadsnakes”.

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
$ sudo apt install python3.6

Ubuntu 16.10 and 17.04

For Ubuntu 16.10 and 17.04, Python 3.6 package is in the Universe repository and can be installed very easily using following commands.

$ sudo apt update
$ sudo apt install python3.6

Check current versions.

If you want to check current versions, try following commands

$ python -V
Python 2.7.12
$ python3 -V
Python 3.5.2
$ python3.6 -V
Python 3.6.4

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.