How To Install Python 3.11 on Centos 7

This article intends to teach you How To Install Python 3.11 on Centos 7.

Python 3.11 was published on October 24, 2022. This latest version of Python is faster and more user-friendly. After seventeen months of development, it’s now ready for prime-time use.

As in every version, Python 3.11 comes with lots of improvements and changes. 

These are some new features and improvements of Python 3.11:

  • Better error messages with more informative tracebacks
  • Faster code execution due to considerable effort in the Faster CPython project
  • Task and exception groups that simplify working with asynchronous code
  • Several new typing features that improve Python’s static typing support
  • Native TOML support for working with configuration files

Steps To Install Python 3.11 on Centos 7

Currently, the latest stable version of Python is 3.11.1. In this guide, you will learn to install Python 3.11.1 on Centos 7.

To complete this guide, you need to log in to your server as a root or non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup Centos 7.

Install Python 3.11 on Centos 7

First, you need to update your local package index with the command below:

sudo yum update -y

Install Python Dependencies

Then, use the following command to install the required packages on Centos 7:

# sudo yum groupinstall "Development Tools" -y 
# sudo yum install wget openssl-devel libffi-devel bzip2-devel -y

Download Python 3.11

Now use the wget command to download Python 3.11.1 from the Python Releases page.

sudo wget https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tgz

Extract your downloaded file with the following command:

sudo tar xvf Python-3.11.1.tgz

Next, switch to your Python 3.11 directory:

cd Python-3.11.1

Build and Install Python 3.11

To set up Python installation on Centos 7, run the command below:

./configure --enable-optimizations

After that, use the following command to build Python on Centos 7:

sudo make altinstall

This will take some time to complete.

Verify Python and pip 3.11 Installation on Centos 7

When you are done, you can verify your Python installation on Centos 7 by checking its version:

python3.11 --version
Output
Python 3.11.1

Also, pip 3.11 must be installed on your server. To check it run the following command:

pip3.11 --version
Output
pip 22.3.1 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)

Here you can test your Python 3.11 that is working correctly on your Centos 7.

Access Python shell on Centos 7

At this point, you can access your Python shell with the command below:

python3.11

Create a Test Program

Now you can write a simple program to find the sum of two variables, x, and y to test your program:

x = 35

y = 75

z = x + y

print("Hello, the sum of x and y is", +z)

In your output you will see:

Hello, the sum of x and y is 110

Conclusion

At this point, you have learned to Install Python 3.11 on Centos 7.

Hope you enjoy it.

May you will be interested in these articles:

How To Install Wekan Server on Centos 7

Enable RPM Fusion Repository on Centos 7

How To Install Postman on Centos 7

How To Install Tor Browser on Centos 7

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular