Updated April 10, 2023
Introduction to Install Python on Linux System
The following article provides an outline for installing Python on Linux. Before going to the python installation tutorial, it is important to understand the Linux operating system. Linux is an interface provider like every other operating system, but unlike other operating systems, it has various advantages that make Linux a top priority in almost all technological fields.
Some of its advantages are:
- Open-source operating system free of cost.
- It is secure compared to other OS.
- It is faster and more compatible; it can handle any file format.
- Linux has various distribution systems, such as Arch Linux, Ubuntu, Fedora, Kubuntu, etc.
- Linux can be easily customized to our preferences.
So even in the Data Science world, people prefer Linux operating systems because of their advantages.
Python on Linux Instructions
Below are the details of Python on Linux:
Python is a powerful and popular programming language. It can be installed on various versions of the Linux operating system. Some Linux version that has an RPM Package Manager, such as, CentOS, Fedora has Python pre-installed, and we can check it by typing the following code in the command prompt:
Code:
Python - - version
If the following code gives an error, we can assume that python is not pre-installed. Even if python is pre-installed, we can update the version for using Interactive Environment (IDLE). Python installation requires a python interpreter, which can be obtained from Python Software Foundation (https://www.python.org/) for installation in other operating systems. For Linux, a package manager is used for installing python.
Install Python on Linux System
Following are the steps to follow:
#Step 1: Go to the Python site through your browser and navigate the download page. (https://www.python.org/downloads/). We need to select the Linux/UNIX option from various other operating systems.
#Step 2: Now, a web page consists of different releases of the python versions. We need to choose a link that is required for our version of Linux from the different releases.
#Step 3: After clicking on the desired link, we will get a pop-up window for opening or saving the python download file; click on the Save option. This would let the Python source files to start downloading.
#Step 4: After the file is downloaded, open the zipper downloaded file. Extract the files to a specific Python folder. Click on the Python folder, and the Archive Manager will begin extracting the downloaded files in the Python subfolder.
#Step 5: Now, a Terminal window is opened, and to proceed with the installation, build-essentials must be installed in our systems, such as SQLite or bzip2.
#Step 6: In the terminal, type in and Enter the code.
Code:
sudo apt-get install build-essential
- Linux installs the Build Essential that is required to build the packages.
#Step 7: In the terminal, we need to type in and Enter the following code.
Code:
sudo apt-get install libsqlite3-dev
- After the code is run, Linux will install the SQLite support required by Python for database management.
#Step 8: After SQLite installation, we need to install bzip2 that is required for the archive manipulation type and enter the following command.
Code:
sudo apt-get install libbz2-dev
Linux installs the bzip2 support required by Python.
#Step 9: Type and enter CD Python <version> in the Terminal window after the zip installation. The terminal will change the directories to the Python 3.3.4 folder on our system.
#Step 10: Once the directories are changed, we need to configure the system to verify the system-built type.
To perform this task, type and enter the following code:
Code:
./configure
#Step 11: As soon as this task is performed, type in and Enter.
Code:
make
After pressing Enter, the python application software is created. This application software is creation takes time depending on the speed of our system.
#Step 12: At this stage, the installation is almost done, and we need to give the administrator password to finish the process for; that type in the following code and press Enter.
Code:
sudo make altinstall
#Step 13: After typing and Entering the code, python will be installed in our system. Check the version by typing the “python – – version” code and check the particular version has been installed. Now we can perform python programming in our Linux system.
Conclusion
Even though python works in various environments, the Linux operating system always has the edge over other operating systems. It is stable compared to windows, especially when we are using large bits of data, and even in the deployment process, the environments are mostly Linux. So, it is always better to practice python programming in the Linux environment.
Recommended Articles
This is a guide to Installing Python on Linux. Here we discuss the introduction to the linux system, python in linux, and installing python on linux. You can also go through our other related articles to learn more –