How to Install Python in Linux

A Step-by-Step Guide to Installing Python 3.13

Python is a versatile programming language used for various applications, from web development to data science. This guide will help you install Python 3.13 on a Linux system using the DeadSnakes PPA repository.

Step 1: Check the Current Python Version

Before installing Python, check if you already have it installed and which version is running. Open your terminal and type:

python --version

Alternatively, for Python 3:

python3 --version

Step 2: Update System Packages

Ensure your system’s package lists are up-to-date by running the following command:

sudo apt update

Step 3: Upgrade Existing Packages

To keep your system secure and stable, upgrade the installed packages:

sudo apt upgrade

Step 4: Install Required Software

The software-properties-common package is required for managing PPA repositories. Install it by typing:

sudo apt install software-properties-common -y