$ yum install gcc openssl-devel bzip2-devel
$ yum install libffi-devel
$ cd /usr/src
$ wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
$ tar xzf Python-3.7.2.tgz
$ cd Python-3.7.2
$ ./configure --enable-optimizations
$ make altinstall
$ rm /usr/src/Python-3.7.2.tgz

Running the following command will confirm the installation of python 3.7:

$ python3.7 -V

Python 3.7.2

Typing python3.7 will give you access:

# python3.7
Python 3.7.2 (default, Mar  6 2019, 06:59:38)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

The following commands were issued to remove the old symbolic link, create a new one and test it:

$ sudo rm /usr/bin/python
$ sudo ln -s /usr/src/Python-3.7.2/python /usr/bin/python
$ python -V

After these commands python 3.7.2 is now the default python version used by the system.

Leave a Reply

Your email address will not be published. Required fields are marked *