Hey, buddy hopes you all are well. After showing the record screen on Linux by kazam this is my other Linux tutorial. The latest version of python 3.8.2 has been released for general use. You can easily download and install the latest stable version of Python (Python3.8.2) on your system. This article will help you to install Python in Linux Os, like Ubuntu, Debian, Elementary, and Linux Mint.
Table of Contents
Python
Python is a well-organized easy to learn, powerful programming language. You can develop a Desktop GUI application, Mobile application, and an awesome web application. Before working with python language and run python code you must have to install python in your system. So, let’s begin to install Python in Linux (Your system).
If you have Windows Desktop read: install Python on windows
Python installation
There is two different way to install python in Linux. We can install python via PPA and then via Source Code. Sometimes PPA installation can throw some issues but Source code installation is more secure. So, let’s get started.
[NB: If you Don’t Have Python installed You can Skip this Step]
System Configuration
If you have the previous version of Python installed Then Make Sure That is Removed. For Completely remove Python from your System follow the step shown below.
1. Frist show is Python installed. [Paste the command in terminal]
python --version
# If Python is installed then this common will show you the version of Python
2. Uninstall Python
sudo apt purge remove python
3. Remove All Depending file
sudo apt purge python
# It will remove All Depending file related Python
Install Python in Linux Via PPA
We can easily install it available in PPA Repositories. As before I say in several cases installing is PPA
can throw some issues. In this case, you may have to install Python via Source code. To install Python via PPA follow the step shown below.
1. Update the package list
sudo apt update
2. Install pre-requirements
sudo apt install software-properties-common
3. Install Deaddsnakes to PPA Repositories
sudo add-apt-repository ppa:deadsnakes/ppa
[Press Enter to conteneu]
4. Install Python in Linux
sudo apt install python3.8
Your Python installation is completed. python will install in /user/lib/python3.8 The default of Python 3 remains installed /user/lib/python3.
Install Python in Linux Via Source Code
In this step, we will show How can install Python via source code. In this case, first, we have to download and then install Python. For installing Python Via source code follow the step shown below.
Pre-requirements
If you want to install Python via Source code then you have to install some libraries. This library will compile python source code for install on your system. so let’s get started.
Paste those command in the terminal step by step:
sudo apt-get install build-essential checkinstall
And this command
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Download Python 3.8 Source Code
You can download the Specific python version from python’s official site. for downloading and extracting python source code follow the steps shown below.
1. Change directory to opt
cd /opt
2. Download Python source code
sudo wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
3. Extract Python source code archive file
sudo tar xzf Python-3.8.2.tgz
Compile and install source code
For install and compiling python source code into your system use those commands:
1. Change directory to python-3.8.2
cd Python-3.8.2
2. Configure
sudo ./configure --enable-optimizations
3. Install Python
sudo make altinstall
WE ARE SUCCESSFULLY INSTALL PYTHON IN LINUX
Confirm Python installation and Check the version
After installing Python in Linux we have to check the version for the confirmed python installation. for the check, the Python 3 version uses the command shown as below.
python3.8 -v
After successful installation removes the archive file to increase disk space.
1. Change direction to /opt directory
cd /opt
2. Remove archive file
sudo rm -f Python-3.8.2.tgz
Last Word
If you have any problem installing Python Linux (In your System). Leave a comment I will try to solve it. All is well and stay with technology.
Thanks for Reading!