Installing the Latest Python 3.7 on Ubuntu 16.04 | 18.04

Python, a general-purpose programming language which is versatile and popular can easily be installed on Ubuntu via multiple methods… This post shows students and new users how to manually install the latest version of Python programming language on Ubuntu 16.04 | 18.04.

This post will also show you how to install Python via a third-party PPA which makes managing and updating to future versions easier from the PPA repository..

With Python, you can do almost anything like writing simple or advanced scripts, build and program robots and complicated machineries, develop websites and many more…. Python lets you work quicklyand integrate systems more effectively..

When you’re ready to install Python, continue with the steps below:

There are many ways to install Python on Ubuntu… Below are two methods that show you how to manually install from source code and via third-party PPA repository…

Method 1: Manually Installing Python

Some users may want manually install the latest version of Python on Ubuntu by building from the source code… To do that they will need to download the installer file and run the executable…

Before installing Python from its source code, you must first install some required packages that are needed to build Python from source.. To get these packages installed, run the commands below:

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

After installing the above packages, go and download the latest release’s source code from the Python download page using the following wget command..

cd /tmp
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz

At the time of writing this post, 3.7.2 is the latest Python version… If you find a later version on the site, you can download it instead…

After downloading the package, run the commands below extract the file and install..

tar -xf Python-3.7.2.tar.xz
cd Python-3.7.2
./configure --enable-optimizations

Next start the building process using the make command.. Replace the #1 with the number of CPU cores on your system for faster build time… My machine has 1 CPU core, so I use the make command with -j 1 option…

make -j 1
sudo make altinstall

Do not use the standard make install as it will overwrite the default system python3 binary…

After that, Python should be installed and ready to use…

To test if Python is installed and ready to use, run the commands below

python3.7 --version

You should see an output similar to the one below:

Python 3.7.2
That’s how you install Python from its source

Method 2: Installing Python via PPA

If you quickly want to get the latest version of Python installed on Ubuntu and get future updates automatically, then you can install it from the below third-party PPA repository…

To do that, run the commands below to add the PPA.

First install Ubuntu software properties package if it’s not already installed on your system..

sudo apt update
sudo apt install software-properties-common

After that run the commands to add the PPA..

sudo add-apt-repository ppa:deadsnakes/ppa

Finally, run the commands below to install Python 3.7

sudo apt update
sudo apt install python3.7

That’s it!

You have learned how to manually install Python from its source code as well as how to add a third-party PPA to install the latest version of Python…

You may also like the post below:

Concrete5 CMS v8.4.4 Released — Here’s How to Install / Upgrade on Ubuntu 16.04 / 18.04

One Reply to “Installing the Latest Python 3.7 on Ubuntu 16.04 | 18.04”

Leave a Reply

Your email address will not be published. Required fields are marked *

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

%d bloggers like this: