Open In App

How to install Python in Ubuntu?

Last Updated : 07 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

This article will guide you through the steps to install Python on Ubuntu, ensuring you're ready to start coding quickly. We will focus on installing Python 3, which is the most widely used version today.

Python is typically pre-installed on Ubuntu, particularly Python 3, as it's an essential part of the system for various tasks and applications.

To install Python on Ubuntu, you can use various methods through the Linux terminal or the command line. This guide will outline these methods to help you get started with Python programming effortlessly.

How-to-install-Python-in-Ubuntu
How to install Python in Ubuntu

Install Python on Ubuntu using APT Installer

In the below section, we will discuss the step-by-step process to install the Python on Ubuntu also the process you are going to opt here is compatible with Ubuntu 20.04, 22.04 and 24.04.01.

Step 1: First Updates the List of Available Packages

  • Open the Linux Terminal & execute the following Linux Command that will update all the packages installed there.
sudo apt update
sudo-update
sudo apt update

Step 2 Update the Available Package

  • After executing the update command, you have to execute upgrade command and to do the follow the below command.
sudo apt upgrade
sudo-upgrade
sudo apt upgrade
  • Now, directly paste the following command in the Terminal & execute it. It will directly download the latest Python File.
sudo apt install python[version number]

install Python in Ubuntu

Install Python on Ubuntu using Repository

Step 1: Access the Python Module

  • On the Linux Terminal, the following command will be used. It will start accessing the Repository of the Python Module.
sudo apt install software-properties-common

install Python in Ubuntu

Step 2: Download the Python Package

  • Now, the following command execution will download the Python Package on the device.
sudo add-apt-repository ppa:deadsnakes/ppa

install Python in Ubuntu

Step 3: Run Install Command to Install Python

  • Execute the following command to get any version of Python, even some older ones on your Ubuntu device.
sudo apt install python[version number]

install Python in Ubuntu

Step 1: Download Python for Python Official Website

  • Browse to the Official Python Page & copy the Gzipped Source Tarball link for any version.

install Python in Ubuntu Step 2: Open Ubuntu Terminal

  • Paste the link in the Linux Terminal as the following.
sudo wget <Copied Link>

install Python in Ubuntu

Step 3: Download TGZ File

tar -xf <TGZ File Name>.tgz

install Python in Ubuntu

Step 4: Configure Python File

  • Now, the following command should be executed to Configure the extracted file before installation.
./configure --enable-optimizations

install Python in Ubuntu

Step 5: Install Python

  • At last, the follow the below command to Directly Install the file on the Ubuntu system.
sudo make install

install Python in Ubuntu

Conclusion

By following the steps outlined in this guide, you can easily install Python in Ubuntu and set up your development environment. Whether you're using the default Python installation that comes with Ubuntu or you want to install a specific version, this process is straightforward and efficient. Having Python installed on your Ubuntu system opens up a world of programming possibilities, from web development to data science.


Next Article
Practice Tags :

Similar Reads