Tutorial How To Install Python 3.9 On CentOS 8 & Centos 7. Python programming language is an object-oriented programming language that has many applications in cases such as web software design, performing complex calculations and operations, rapid prototyping, and is used by most of the most visited and large sites in the web world. One of the advantages of Python is that it can be used for most web design and other related tasks and does not impose any particular restrictions on the user. This explanation was an introduction to the Python language so that we can teach you How To Install Python 3.9 On CentOS in the rest of this article. Please be with us. You can also see the packages available in Eldernode if you need to buy CentOS VPS server.
Table of Contents
How To Install Python 3.9 On CentOS 8
First, install the required Python development libraries using the following command. Then follow steps 1 to 4 in the rest of this tutorial:
sudo dnf install gcc openssl-devel bzip2-devel libffi-devel
Step 1: How To Update CentOS
Before you do anything, you need to update Centos, do this with the following command:
Step 2: How To Download Python 3.9
You can download Python from its official site using the following command.
cd /opt wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0tgz
Note: If wget is not enabled, you can install it with the following command:
yum install wget -y
Then, with the command below, you must extract the downloaded archive:
tar xzf Python-3.9.0tgz
Step 3: How To Install Python On CentOS
After extracted, go to the Python-3.9.0 folder, Then configure the source files based on your server or system environment.
cd Python-3.9.0 sudo ./configure --enable-optimizations sudo make altinstall
Step 4: How To Test Python On CentOS 8
After completing the installation steps, we test the installed version of Python with the following command:
The output should be as follows:
How To Install Python 3.9 On CentOS 7
Still, working with the 7 version of CentOS? Install Python 3.9 on it to do almost anything you want, write small scripts, build games, develop websites, create machine learning algorithms, analyze data, and more. Or if you are used to working with ouTube, DropBox, Reddit, Quora, Instagram, Pinterest it is a good idea to install Python because they all have been developed using Python.
Note: It was necessary to make Python 3 available for installation by setting up third-party repositories, such as the IUS repository in CentOS 7 releases prior to 7.7 because the CentOS base repository did not provide a Python 3 package. But now, as of CentOS 7.7, Python 3 is available in the base package repository! Let’s go through the steps of this part of the installation.
Step 1: How To Update the CentOS Environment
First, you need to make sure that you are working with the most up to date environment possible in terms of our packages. Run the command below to do this:
[root@centos7 ~]# yum update -y
Step 2: How To Install Python 3
Once you updated the environment, you are ready to install Python 3 by typing the command below:
[root@centos7 ~]# yum install -y python3
Step 3: How To Verify Installation
You can make sure that Python 3 is in fact installed and usable. Use the following commands to do this:
[root@centos7 ~]# python3 Python 3.9.0 (default, Nov 02 2020, 16:23:09) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
You should see the version of Python 3 installed on your system as well as a change in the command prompt characters.
How To Install A Source in Python 3.9
The simplest way of installing Python 3 is to use the Yum package manager, but if you want to have the most recent version of Python available, you should install a source in three required steps to reach this purpose:
Step 1: How To Setup the Python 3.9 Environment from the source
You need to check for prerequisite packages to be installed if you need to install Python 3 from the source:
[root@centos7 ~]# yum install gcc openssl-devel bzip2-devel libffi-devel -y
Step 2: How To Download Python 3.9
Then, grab the version of python you need by running the following command which helps you pulling down the latest stable version of Python:
[root@centos7 ~]# curl -O https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz