How to Install Python 3.6 on Ubuntu 16.04

how to install python 3.6 on Ubuntu 16.04
Installing Python 3.6 on Ubuntu 16.04

Today we will discuss how do you install Python 3.6 on Ubuntu 16.04. Python is a high-level, interpreted, interactive and object-oriented scripting language, and it is one of the most popular programming languages in the world. Python is designed to be highly readable and it can be used to build just about anything. It is using English keywords instead of punctuation and it also has fewer syntactical constructions than other programming languages.

Python allows programmers to use different programming styles for creating their programs, get quicker results and write code almost as if speaking in a human language. Some of the most popular systems and applications in the world that have employed Python during development include Google Search, YouTube, Google App Engine, Maya, and many more. Installing Python 3.6 on Ubuntu 16.04 is an easy task, just follow the steps in this tutorial carefully, and you should have Python 3.6 on Ubuntu 16.04 installed in few minutes. Let’s get started with the installation.

Python 2.7 and Python 3.5 are installed on Ubuntu 16.04 by default. In this tutorial, we will guide you through the steps of installing the latest Python 3.6 on Ubuntu 16.04.

We have an update version of this tutorial on installing Python 3.9 on Ubuntu 20.04.

1. Login via SSH and update all installed packages

First of all, login to your Ubuntu 16.04 VPS via SSH as user root

ssh root@IP_Address -p Port_number

and update all installed packages

2. Check the currently installed version of Python

To check the currently installed version of Python, execute the following command

# python -V
Python 2.7.12

To check the Python 3 version, use the following command

# python3 -V
Python 3.5.2

There are two methods of installing Python 3.6 on an Ubuntu 16.04 VPS, from source, and from PPA.

3. Install Python 3.6 on Ubuntu 16.04, from source

In order to install the latest Python 3.6 release for Linux/UNIX, go to their official website and download its source code to your server. At the moment of writing this article, it is version 3.6.3

cd /opt
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz

and unpack the downloaded archive

tar -xvf Python-3.6.3.tgz

4. Method 1: Run the “configure” script

Change the current working directory and run the ‘configure’ script

cd Python-3.6.3
./configure

If there are no errors, run the following commands to complete the installation process of Python 3.6

make 
make install

If you get the following error message

zipimport.ZipImportError: can't decompress data; zlib not available

install the ‘zlib1g-dev’ package

apt-get install zlib1g-dev

are run ‘make’ and ‘make install’ again.

That’s all. Python 3.6 should be successfully installed at this point. You can check this with the following command

# python3.6 -V
Python 3.6.3

5. Method 2: Install Python 3.6 from PPA

You can also install Python 3.6 from J Fernyhough’s Personal Package Archive (PPA).
Install the following requirements

apt-get install software-properties-common python-software-properties

Run the following command to add the PPA

# add-apt-repository ppa:jonathonf/python-3.6
Press [ENTER] to continue or ctrl-c to cancel adding it

and press enter to continue.

6. Update the repositories

update the repositories

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
apt-get update

7. Install Python version 3.6 on Ubuntu 16.04

and finally, install Python version 3.6

apt-get install python3.6

7. Verify Python 3.6.3 installation

Once it is installed, you can verify the installed version by executing the following command

# python3.6 -V
Python 3.6.3

To learn more about Python version 3.6 check their official release notes.


See alsoHow to Install Python 3.6.4 on CentOS 7

Install Python 3.6 on Ubuntu 16.04

Of course, you don’t have to Install Python 3.6 on Ubuntu 16.04, if you use one of our Python VPS hosting services, in which case you can contact us and ask our expert Linux admins to Install Python 3.6 on Ubuntu 16.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Python 3.6 on Ubuntu 16.04, please share it with your friends on social networks or simply leave a reply below. Thanks.

There is a new updated article on how to install Python 3.9 on Ubuntu 20.04.

13 thoughts on “How to Install Python 3.6 on Ubuntu 16.04”

  1. For more information about how to install pip you can check our tutorial:
    https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/

    Reply
      • To install pip, you can also do it by invoking these commands:

        wget https://bootstrap.pypa.io/get-pip.py
        sudo python3.6 get-pip.py

        Reply
        • root@reportingservice-ambarisvr:/opt# python3 get-pip.py
          Traceback (most recent call last):
          File “get-pip.py”, line 23470, in
          main()
          File “get-pip.py”, line 198, in main
          bootstrap(tmpdir=tmpdir)
          File “get-pip.py”, line 82, in bootstrap
          from pip._internal.cli.main import main as pip_entry_point
          zipimport.ZipImportError: can’t decompress data; zlib not available

          I get this error.

          How can i install zlib for this version of python when pip is not available….

          Reply
  2. Hello
    I’m having problems to start this tutorial. Actually, at step 1 i didn’t understand what I have to do (i’m a beginner with Ubuntu).

    I wrote “ssh root@IP_Address -p Port_number” (without “) in the terminal and it’s returns was “Bad port ‘Port_number”.
    Can someone help me?

    Reply
    • You should change IP_Address with your server IP address (ex 12.12.31.12) and Port_number with the SSH port number (only if SSH is not listening on the default port 22).

      Reply
  3. Cllearly large corporations have been abusing the good will of volunteers creating open source software.

    The JonathonF ppa is no longer accessible.

    JonathonF ppa on Launchpad
    Python 3.6
    “This PPA has been removed from public access as part of a protest against the abuse of open-source projects by large companies. “

    Reply

Leave a Comment