How to install Python 3.7 in Ubuntu

  1 year ago     Views:  818  
Site Admin
4 Follows

Python has become popular programming language among the developers for its easy syntax compare. Python is general-purpose programming language used for machine learning, AI(Artificial Language) purpose and Web developing.

In this article, we will discuss how to install Python 3.7.4 in Ubuntu, which is currently latest stable version. Though Python 2.7.X comes preinstalled, we recommend to install latest stable version, Python 3.7.4 along with Python 2.7.X.

Note: You need to be logged as root user for able to install packages in system.

You can install Python 3.7 by two ways

1) By adding PPA and installing via command line

This is the easy way to install any packages.

First open Terminal by using CTRL + ALT + T key or go to menu and select Terminal.

If you are on Ubuntu 16.10 or newer version, Python PPA is already set in the repository list. Just use the following commands:

sudo apt-get update
sudo apt-get install build-essential libpq-dev libssl-dev OpenSSL libffi-dev zlib1g-dev
sudo apt-get install python3.7

For Ubuntu 16.04 or older, use following commands:

1. Update the package list by following command

sudo apt-get update

2. Install prerequisites dependencies

sudo apt install software-properties-common

3. Add deadsnakes PPA by following command and press Enter key

sudo add-apt-repository ppa:deadsnakes/ppa
sudo add-apt-repository ppa:jonathonf/python-3.7

4. Install python 

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

2) By downloading source file and installing manually

In this way you need to download python source file and install.

1. First update package list and install required packages that will be used to install Python from source file.

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

2. Download source file

cd ~/Downloads

3. Extract source file

sudo tar xzf Python-3.7.4.tgz

4. Compile source file

cd Python-3.7.4
sudo ./configure
sudo make
sudo make install


Now you have installed python latest version in your system. To check Python version use following command:

python3.7 --version

To get binary location of Python, use command:

which python3

Do you have any questions or comments about this article? Feel free to write in bellow comment section.

Was this article helpful?

1 out of 1 person found this article helpful.

Leave a comment


No Comments