How to Install Python 3.7.9 on Linux CentOS 7

How to Install Python 3.7.9 on Linux CentOS 7 - Good mornings friends. On this occasion I will share about how to install python 3.7.9 on a server with CentOS 7.9 Linux OS.

Basically on Linux there is python, but the default version is EOL on January 1 2020.

How to Install Python 3.7.9 on CentOS 7.9
How to Install Python 3.7.9 on CentOS 7.9

Now in this tutorial I will share the install using the downloaded source on the official Python page, you can also try different versions but the rarity is still the same.

When I made this tutorial I used CentOS 7.9 Linux OS.


I have prepared a folder to store the required files in "/home/kitsake/python".

In the process of upgrading Python, consider the benefits of configuring a local yum repository. This approach facilitates a more streamlined and controlled environment for managing Python packages, ensuring a smoother transition and efficient distribution of the upgraded Python version across your system.
# cd /home/kitsake/python
# wget
# tar -xzvf Python-3.7.9.tgz


To install, you can follow the steps below and adjust the version if you install a different version with the tutorial below.

# cd /home/kitsake/python/Python-3.7.9
# ./configure --enable-optimizations
# make altinstall


Usually when we install a new version of python, the old version will still be there and change some of the logic in the current OS. So, we have to change or rearrange it with the steps below.

[root@SYSADMIN-DEV ~]# yum install nano
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
SyntaxError: invalid syntax
[root@SYSADMIN-DEV ~]#

From the above cases can be done in the following way.

# vi /usr/bin/yum
From #!/usr/bin/python to #!/usr/bin/python2.7
# vi /usr/libexec/urlgrabber-ext-down
From #!/usr/bin/python to #!/usr/bin/python2.7

Now for the final configuration, create a link to the python command and point it to the latest version or the one we installed above.

# unlink /usr/bin/python
# ln -s /usr/local/bin/python3.7 /usr/bin/python


# cat `which yum` | head -1
# cat `which /usr/libexec/urlgrabber-ext-down` | head -1
# python -V
Check version of python
Check version of python

Now for Python with version 3.7.9 on Linux OS CentOS 7.9 already using the latest version and ready to use, and maybe that's all I share for now, hope it's useful & Thank you.

Bangkit Ade Saputra
Bangkit Ade Saputra At the end of the day, my job involves people. we're complicated, we're always changing, we have millions of things going on in our lives, and changing jobs is always a big decision.

Post a Comment for "How to Install Python 3.7.9 on Linux CentOS 7"