Installing Python 3.6 on Ubuntu

Since I have been getting a lot of questions about installing Python 3.6 on Ubuntu, I thought I could put together a document for quick reference. The default version of Python on Ubuntu (until 17.04) is Python 3.5. To download and install Python 3.6, follow the commands given below based on your version of Ubuntu.

Ubuntu 14.04 (Trusty), 16.04 (Xenial)

If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull’s deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:

Command 1:

sudo add-apt-repository ppa:deadsnakes/ppa

ubuntu_img1

Command 2:

sudo apt-get update

ubuntu_img2

Command 3:

sudo apt-get install python3.6

ubuntu_img3

Alternatively, you can use J Fernyhough’s PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

Ubuntu 16.10, 17.04

If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:

sudo apt-get update
sudo apt-get install python3.6

After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04

To invoke the Python 3.6 interpreter, run python3.6.

Ubuntu 17.10 and 18.04 (Bionic)

Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.

Advertisements