Skip to content Skip to sidebar Skip to footer

How to Install Python 3.7.9 on CentOS 7.9

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.

Preparation

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

# cd /home/kitsake/python
# wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
# tar -xzvf Python-3.7.9.tgz

Installing

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

Configure 

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.

[[email protected] ~]# yum install nano
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax
[[email protected] ~]#

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

Trying

# 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 Hard-working professional with experience and a proven knowledge of operating system, server architecture and system configuration.

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