How to Install Latest Python on Linux from Source | Step-by-Step Guide

Опубликовано: 12 Май 2026
на канале: LinuxTechi
386
10

Want to install the latest Python version on your Linux system but can’t find it in your package manager? In this step-by-step tutorial, I’ll show you how to compile and install Python from source on Ubuntu, Debian, RHEL, CentOS, and other Linux distributions.

🚀 Why Install Python from Source?
✔️ Get the latest Python features and performance improvements
✔️ Full control over the installation process
✔️ Works across different Linux distributions

📌 Steps Covered in This Video:
🔹 Install dependencies on Ubuntu/Debian & RHEL-based distros
🔹 Download and extract the latest Python source code
🔹 Compile and install Python with optimizations
🔹 Use update-alternatives to manage multiple Python versions
🔹 Verify Python installation and install packages with pip3.13

📢 Commands Used in This Video:

[For Debian/Ubuntu-based systems]

sudo apt update && sudo apt install -y build-essential libssl-dev zlib1g-dev \
libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev \
libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev \
liblzma-dev tk-dev

[For RHEL-based systems]

sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc gcc-c++ make zlib-devel bzip2 bzip2-devel \
readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel

Download Python : https://www.python.org/downloads/

./configure --enable-optimizations
sudo make altinstall

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.13 2

sudo update-alternatives --config python3

📺 Watch more Linux tutorials:
🔹   • How to Install Java on Ubuntu 24.04 | Open...  
🔹    • How to Install KVM on RHEL 9 | Setup Virtu...  
🔹    • How to Configure Static IP Address on Ubun...  

👍 Like & Subscribe for more Linux, DevOps, and Cloud tutorials! 🔔
#Python #Linux #PythonInstallation #Ubuntu #DevOps