Installing Python on Ubuntu and How to Do It

We independently review everything we recommend. When you buy through our links, we may earn a commission.

Installing Python Ubuntu How Do

Do you need Python to be installed on your Ubuntu computer? Here is everything that you require, from the commands required for installation to those required for upgrading and beyond.

Python is pre-installed on nearly all Linux distributions, and the version that is used is typically part of the default package set. On the other hand, for a variety of reasons, it is possible that an Ubuntu machine will not have Python installed on it.

Let’s take a more in-depth look at the process of installing Python on Ubuntu, and then we’ll move on to a quick tutorial on how to update the Python package.

How to Determine whether Python Is Installed on Your PC

Python is a robust and feature-rich high-level programming language that is utilized by a large number of developers all over the world. The language performs exceptionally well in a wide range of real-world applications, such as web development, web scraping, and penetration testing, amongst others. Python may also be used to create a bot for use with Telegram.

Open up your terminal by hitting the Ctrl, Alt, and T keys on your keyboard. This will allow you to determine whether or not Python is already installed on your computer. After typing “python3,” hit the “Enter” button.

If the following output appears in your terminal, this indicates that Python is already installed on the Ubuntu computer you’re using.

Python 3.11.0a7 (main, Apr 20 2022, 17:44:14)
[GCC 9.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

This output supplies information on the version of Python that is currently installed on your system in addition to the date and time that is currently in effect.

If, on the other hand, you come across an error that reads “bash: python3: command not found,” then it is unfortunate that the Python programming language is not pre-installed on your Ubuntu computer.

You may also determine the version of Python that is being used by entering the following command into your terminal:

python3 –version

The result will provide you with information on the version of Python is now installed on your machine and which versions have been installed in the past.

On Ubuntu, How Do I Install Python

Python may quickly and easily be installed on Ubuntu. You may obtain the most recent version of Python from a variety of different places. The following is a list of some of the suggested methods for accomplishing the same goal:

Python install via APT.

On Ubuntu, the package manager that is installed by default is called APT, which stands for Advanced Package Tool. You may get the Python package from the official Ubuntu repository, which is available for download. This is the procedure to follow:

  • You may launch your terminal by hitting the Ctrl, Alt, and T keys simultaneously.
  • You may bring the repository list for your local system up to date by executing the following command:

sudo apt update

  • Download the latest version of Python:

sudo apt install python3

  • Your machine will have the package installed on it automatically when it is located by APT and downloaded.

To install Python 3 on Ubuntu, use the Deadsnakes PPA

If, for whatever reason, you are unable to get the Python package from the official Ubuntu repositories, you might want to try adding the Deadsnakes PPA to the list of system repositories that you use on your computer. PPAs, which stand for “Personal Package Archives,” are a type of repository that has been tailored specifically for Ubuntu users.

By default, you can’t add PPAs to your system. On Ubuntu, the “software-properties-common” package gives users an effective means of managing and adding PPAs.

  • Simply enter the following command into your command prompt to have the aforementioned package installed on your computer:

sudo apt install software-properties-common

  • Include the official link to the Deadsnakes PPA in the list of repositories for your system:

sudo add-apt-repository ppa:deadsnakes/ppa

  • Update your system’s package list:

sudo apt update

  • Download the latest version of Python from the added PPA:

sudo apt install python3

You are able to install earlier versions of Python thanks to the Deadsnakes Python Package Archive (PPA), which contains nearly every version of Python available. You only need to change the name of the package to reflect the version of Python that you wish to have on your machine.

sudo apt install python3.2
sudo apt install python3.3
sudo apt install python3.8

Python 3 installation using the source code on Ubuntu

Additionally, the most recent version of Python may be downloaded and built directly from the official Python website. After you have familiarized yourself with the procedure, compiling the source code will no longer present you with the same level of difficulty it did when you initially attempted it.

  • Make sure the list of local repositories on your system is up to date:

sudo apt update

  • Install supporting dependencies on your system with APT:

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

  • Make a new directory to store the Python source files:

mkdir /python && cd /python

  • Download the Python source code from the official FTP server:


  • Extract the contents of the TGZ file that you downloaded just now:

tar -xvf Python-3.11.0a7.tgz

  • Before installing Python, you must first run certain tests and make any necessary optimizations. This is significant since it will boost the pace at which your code is executed by at least 10 percent:

cd Python-3.11.0a7
./configure –enable-optimizations

  • Construct the package by employing the MakeFile that is located within the directory:

sudo make install

After you have finished implementing these procedures, open the terminal and type python3 —version to determine whether or not Python has been installed on your own machine.

Take into consideration that PIP is used to manage Python modules. PIP is an acronym for Python Installer and Packager, and it is a package management system that allows users to download and add libraries from the Python Package Index. If you wish to use more modules in your next Python project, you will need to make sure that Python PIP is installed on your machine.

Installing the Most Recent Version of Python

First things first, check to see whether you have an older version of the Python programming language installed on your computer. In order to accomplish this, open the terminal on your computer and type python3 —version. Take careful note of the version specifics.

Simply conducting a search on the internet will allow you to obtain information on the most recent current version. It would be sufficient to conduct a fast search on Google for “python newest version number.” If the two figures don’t add up to the same total, then you are most likely using an old version of the software.

Using Ubuntu’s Advanced Package Tool, upgrading to the most recent version of Python is a simple process. Enter the following command to get the most recent version of Python on your computer if you have Python installed on your system using APT or the Deadsnakes PPA:

sudo apt install python3

In addition, the —only-upgrade flag can be utilized in order to bring your packages up to date.

sudo apt –only-upgrade install python3

You can download a copy of the most recent version of Python through the Python File Transfer Protocol (FTP) if you have already constructed Python on your own from the source code. To successfully create the package, however, you will need to go through all of the processes once more.

Using Python in Ubuntu

Python may be found in the official software repositories of all Linux distributions and comes pre-installed on nearly every Linux operating system. If you still do not have Python installed on your computer, the package manager that comes with Ubuntu will allow you to simply download and install Python.

Python is a general-purpose programming language that has applications in a wide range of fields; these applications alone are sufficient to illustrate the language’s prowess. Because of the increased need for software engineers across all sectors of the economy, programming languages have recently emerged as being of the utmost significance.

We will be happy to hear your thoughts

Leave a reply