Install Python 3.x from Source on CentOS or RHEL

From UVOO Wiki
Revision as of 15:24, 13 January 2020 by Busk (talk | contribs)
Jump to navigation Jump to search
#!/bin/bash
# This should work on CentOS 6 and greater
set -e
python_version=3.6.9

yum install -y gcc openssl-devel bzip2-devel libffi-devel curl tar
cd /usr/src
curl -O https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz
tar xzf Python-${python_version}.tgz
cd Python-${python_version}
# ./configure --enable-optimizations  # This takes longer to compile
./configure
make altinstall
rm /usr/src/Python-${python_version}.tgz
python3.8 -V

Using newer versions on CentOS 6

python_version=3.8.1 # ssl issue may have to use --with-openssl=/path/to/your/local/install

python_version=3.7.5 # ssl issue

https://help.dreamhost.com/hc/en-us/articles/360001435926-Installing-OpenSSL-locally-under-your-username