×


Install Python on Ubuntu 18.04 - Step by Step Process ?

Python is popular programming language which by default, in Ubuntu 18.04 python 3 comes pre-installed as the default interpreter. When you perform Ubuntu Installation in its Minimal version, then it does not come pre-installed. In fact, Python is a versatile programming language and you can use it to write small scripts, build games, develop websites, create machine learning algorithms, analyze data and more.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Software Installation queries on Linux systems.

In this context, we shall look into the best way to install Python on Ubuntu 18.04.


How to Install Python 3 on Ubuntu ?

Before you start installing Python on Ubuntu 18.04 you must logged in as non-root user account with sudo privileges.

Now, follow the easy steps given below.


1. Update system

To begin, update the package manager index by issue below command: 

$ sudo apt update


2. Install python 3

Now run the below command to install python 3 with minimal installation:

$ sudo apt install python3-minimal

You can verify the installation by executing below command:

$ python3 -V

The output of this command will display the version of python installed in the system.


How to Install Python 3.7 on Ubuntu ?

Python 3.7 includes many new features. You can get more details about Python 3.7 from official website

The first step to perform this Installation procedure is to update package manager index and install prerequisites by running below command:

$ sudo apt update
$ sudo apt install software-properties-common

Next, you need to add the deadsnakes PPA to your sources list using below command:

$ sudo add-apt-repository ppa:deadsnakes/ppa

You will be prompted with message so here hit Enter key to continue:

Press [ENTER] to continue or Ctrl-c to cancel adding it.

Now, repository is enabled so issue below command to install python:

$ sudo apt install python3.7

Now you can check installed version of python by typing:

$ python3.7 --version


How To Install Python 3.9 on Ubuntu 18.04 ?

Here, you will learn how to Install Python 3.9 Using Apt-Get. The Apt package manager provides simple way for installing Python 3.9 on Ubuntu system. Follow the steps below:

1. Open a terminal on your system and configure deadsnakes PPA to your system:

$ sudo add-apt-repository ppa:deadsnakes/ppa 

2. Once you added the PPA on your Ubuntu system, update the apt cache and install Python 3.9 on Ubuntu:

$ sudo apt update 
$ sudo apt install python3.9 

3. Now, Check the Python version by executing:

$ python3.9 -V 


How to Install Python Modules ?

By default, Ubuntu repository have many Python modules. You can search specific modules using below command:

$ sudo apt search MODULE_NAME

Here, you should replace MODULE_NAME with module name which you want to search.

After that, you can install searched module with with following command:

$ sudo apt install MODULE_NAME

Same as above replace MODULE_NAME with module name.


How to Install & Manage Python Packages ?

PIP is a package management system used for installation and management of software packages in Python. PIP stands for Python Package Index (PyPI). It is very popular for python package management. You can get more details on following link : How to Install Pip on Ubuntu 20.04 LTS.


How to Uninstall Python from Ubuntu Linux system ?

In case you no longer wish to have Python installed on your Ubuntu 18.04 system, here's what you need to do:

First, find out what version of Python you have installed by typing:

$ python –v

Let's say the output says that you have Python 3.9 installed. You can uninstall it using the following command:

$ sudo apt autoremove python3.9


[Need assistance in Configuring Python on Ubuntu Linux system ? We can help you. ]


Conclusion

This article covers the different ways to install Python on Ubuntu Linux system. In fact, Python is an object-oriented, high-level programming language. It is open-source with a large community. Python is used as a key language among the top tech companies like Google. Now you can start developing your Python 3 project.