Hey, buddy hopes you all are well. 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.
Python is a well-organized easy-to-learn, powerful programming language. You can develop a Desktop GUI application, a Mobile application, and an awesome web application. Before working with python language and running python code you must have to install python in your system. So, let’s begin to install Python on Linux (Your system).
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]
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 the terminal]
# 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 files related to Python
Install Python in Linux Via PPA?
We can easily install it available in PPA Repositories. As I say in several cases installing 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.
If you want to install Python via Source code then you have to install some libraries. This library will compile python source code for installation on your system. so let’s get started.
Paste those commands 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
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 installing and compiling python source code into your system use those commands:
1. Change directory to python-3.8.2
sudo ./configure –enable-optimizations
3. Install Python
sudo make altinstall
WE ARE SUCCESSFULLY INSTALL PYTHON ON 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 below.
After successful installation removes the archive file to increase disk space.
1. Change direction to /opt directory
2. Remove archive file
sudo rm -f Python-3.8.2.tgz
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!