Install Python 3 on CentOS 7

CentOS 7/Red Hat Enterprise Linux 7 ships with Python 2. Due to long term support and stability, there is no Python 3 available. This article will demonstrate, how to install Python 3 on a CentOS 7 machine. Overall, it is pretty easy but the compilation takes some time.

cd /tmp
yum install -y make gcc libffi-devel zlib-devel
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
tar xf Python*
cd Python*
./configure --enable-shared
make
make install

You can now start python by typing python3.

Just be aware to always point to the right python3 binary/library:
Executable: /usr/local/bin/python3

Example for cmake:
cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/local/bin/python3