Join WhatsApp

Join Now

Join Telegram

Join Now

How To Install Python In Linux | Easy Method 2025

By Saboor Shawkat

Updated on:

Python In Linux
Rate This post

In This Post I Am Going To Show You How To Install Python In Linux. We Will Install Python In Linux So That We Can Run Python Based Files And Programmes At Linux Machine. We Will Do The Basic APT Installation After That We Will Configure And Install Important Dependencies For Python. So Let’s Start,

How To Install Python In Linux?

We Will Install Python In Linux Through A Step By Step Process. Basically Python Comes Pre-installed In Most Of The Linux Distributions But If You Don’t Have One You Can Install It. Follow The Below Steps One By One To Install Python In Termux:

Pre-requisites

Step 1: First Of All Open Your Linux Machine Terminal And Connect To The Internet.

Step 2: Now Update The Linux Packages As One Of The Important Steps Always By Typing sudo apt update Command.

ShellScript
sudo apt update
Update Linux

Step 3: Install Python In Linux By Typing sudo apt install python Command In The Terminal. This Command Can Require Authentication By Typing If Appeared.

ShellScript
sudo apt install python3
Install Python In Linux

Step 4: Wait For The Installation And Check The Installation When Finished By Using python3 --version Command In Linux.

ShellScript
python3 --version
Check Python Version

We Have Installed The Python In Linux But We Need To Install The Pacakge Manager Also For The Python In Linux. Once The Installation Of Python Has Been Completed Now We Install PIP In Linux. These Steps Require Internet Connection.

How To Install PIP In Linux?

Once The Python Has Been Installed In Linux Now We Have To Install Pip In Linux. Follow The Below Step To Install PIP In Linux:

Step 1: First Of All You Must Have Python Installed In Your Linux Machine.

Step 2: Now Open The Terminal And Type sudo apt install python3-pip Command To Install PIP In Linux.

ShellScript
sudo apt install python3-pip
Install Pip In Linux

Step 3: Wait For The Installation, This Can Take Time Depending On Your Internet And Device Speed.

Through These Steps We Can Install Python And PIP In Linux. Now You Can Run And Install Python Programes In Your Linux Machine.

Additional Packages For Python In Linux:

Python May Need Some Additional Pacakges For The Proper And Whole Working In Linux. We Need To Install Some Other Packages For Python In Linux. Type sudo apt install python3-dev python3-venv build-essential Command In Linux To Install These Pacakges.

ShellScript
sudo apt install python3-dev python3-venv build-essential

Wait For These Packages To Be Installed In Your Linux Machine And Enjoy The Python Package In Linux.

How To Install Python On Other Linux Distributions:

All The Linux Distribution Have Different Commands For Installation Updating And Other Things. Below Are The Commands For The Installation Of Python On Different Linux Distro, One Must Note That He Should Be In A Root Terminal And Has Updated The Packages Using Update Command:

For Arch Linux:

Type sudo pacman -S python Command To Install Python In Arch Linux.

ShellScript
sudo pacman -S python

For Fedora Linux:

Type sudo dnf install python3 Command To Install Python In Fedora Linux.

ShellScript
sudo dnf install python3

For RedHat Linux:

Type sudo yum install epel-release Command To Install Python In RedHat Linux.

ShellScript
sudo yum install epel-release

For CentOS:

Type sudo yum install epel-release Command To Install Python In CentOS.

ShellScript
sudo yum install epel-release

Some Common Errors Of Installation Of Python:

We Sometime Can Get Errors While Installation Of The Python In Termux We Can Fix These Type Of Errors By The Following Methods.

Error 1: If You Get A Permission Denied Error While Installing Python In Linux, You Need To Check If You Are A Rooted User Or Not. That Is Denoted By The Starting Of The Terminal.

Error 2: If You Closed The Python Installation Or The Internet Broker Out At The Middle Of The Installation. Now The Installation Does Not Work And It Shows Package Lock Errors You Can Type Below Commanda To Resolve The Error.

ShellScript
sudo rm /var/lib/apt/lists/lock
ShellScript
sudo rm /var/cache/apt/archives/lock

Thene Start The Installation From The Begining To Work. There Are Also Many Other Errors That Can Be Related To The Internet And Server Issue. You Must Check The Internet Connection First And Start The Installation Of Python In Linux.

Conclusion:

Python Installation Is Not A Complicated Process If We Want To Learn. Installing Python In Linux Is Much Need Tutorial As The Python Package Is One Of The Important Packages For Linux. Once The Python Has Been Installed In Linux We Can Code And Run Programes Of Python In Linux. I Have Described The First Way To Install Python In Kali Linux Followed By The Installation Of Python In Different Linux Distributios. I Hope You Have Liked This Post. Check Our Online Linux Terminal To Practice Commands. Thanks For Reading.

Frequently Asked Questions:

How To Check Python Version In Linux?

You Need To Type python --version In Terminal To Check The Version Of Python In Linux.

What Is Python?

Python Is A Powerfull Programing Language That Can Be Used To Develop Programes Games And Other AI Based Models And Tools.

What Is The Extension Of Python File?

The Python File Ends With .py And One Example Of A Python File Can Be filename.py

Leave a Comment