Knowledgebase

How to Install Python on Centos?

  • 48

When you install latest version of Centos, it comes with the outdated Python while the current version is 3.7 or higher. This Article will help you how to install Python 3.7 on Centos 7.5 in a few easy steps.

First login as a root user on CentOS

1.      Requirement Installation.

Run the given command to install prerequisites for Python 3.7.

yum install gcc openssl-devel bzip2-devel libffi-devel

2.      Download Python 3.7

Second step is to download python 3.7 and extract it.

cd /usr/yourfolder

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

tar xzf Python-3.7.0.tgz

3.      Install Python 3.7 on Centos 7.5

Install python by simply running the following commands.

cd Python-3.7.0

./configure --enable-optimizations

make altinstall

now clean up or remove the downloaded file.

rm -f /usr/src/Python-3.7.0.tgz

In last test it to make sure that it was working correctly.

python3.7 -V

It should display you the Python version that you have installed.

Now you have the latest version of Python installed on Centos 7.5!


check out other guides on How to Install Python on AlmaLinux and How to Install Unzip on Ubuntu


Was this answer helpful?