Categories
Computer & Technology Guides Guides

How-To Install Python 3.7 on Centos 7.5

Spread the love

Centos 7.5 ships with the outdated Python 2.7 but the current version is 3.7. This guide will show you how to install Python 3.7 on Centos 7.5 in just a few easy steps.

Install Requirements

Run the following command to install prerequisites for Python 3.7

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

Download Python 3.7

Lets download Python 3.7 to our server and extract it.

cd /usr/src
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xzf Python-3.7.0.tgz

Install Python 3.7 on Centos 7.5

Installing is as easy as running the following commands:

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

now we can clean up the downloaded file:

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

and now we can test to make sure it was installed correctly:

python3.7 -V

Which should return:

Install Python 3.7 on Centos 7.5

You now have the latest version of Python installed on Centos 7.5!


Spread the love

5 replies on “How-To Install Python 3.7 on Centos 7.5”

During execution of yum install gcc openssl-devel bzip2-devel libffi-devel I got an error:
Error: Package: glibc-common-2.17-196.el7.x86_64 (@anaconda)
Requires: glibc = 2.17-196.el7
Removing: glibc-2.17-196.el7.x86_64 (@anaconda)
glibc = 2.17-196.el7
Updated By: glibc-2.17-260.el7_6.3.x86_64 (updates)
glibc = 2.17-260.el7_6.3
Removing: glibc-2.17-222.el7.x86_64 (installed)
glibc = 2.17-222.el7
Updated By: glibc-2.17-260.el7_6.3.x86_64 (updates)
glibc = 2.17-260.el7_6.3
Available: glibc-2.17-260.el7.i686 (base)
glibc = 2.17-260.el7

As a consequence, ./configure –enable-optimizations did not work either
configure: error: in /usr/src/Python-3.7.0':
configure: error: no acceptable C compiler found in $PATH
See
config.log’ for more details

Sorted. I had to upgrade glibc glibc-common libs before installation of the gcc worked:
1) yum upgrade glibc glibc-common
2) yum install gcc openssl-devel bzip2-devel libffi-devel

Leave a Reply

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