How to Install Python 3.7

Step 1 – Requirements

This Python installation required GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.

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

Step 2 – Download Python 3.7

Download Python using the following command from the Python official site. You can also download the latest version in place of specified below.

cd /usr/src

Now extract the downloaded package.

tar xzf Python-3.7.3.tgz

Step 3 – Install Python 3.7

Use below set of commands to compile Python source code on your system using altinstall.

cd Python-3.7.3
./configure --enable-optimizations
make altinstall

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Now remove downloaded source archive file from your system

rm /usr/src/Python-3.7.3.tgz

Important: make altinstall causes it to not replace the built in python executable.

Ensure that secure_path in /etc/sudoers file includes /usr/local/bin. The line should look something like this:

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

No token or token has expired.

Leave a Reply

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


13th Jun 2019