Install Python 3.x from Source on CentOS or RHEL
Jump to navigation
Jump to search
Contents
- 1 Test
- 2 !/bin/bash
- 3 This should work on CentOS 6 and greater
- 4 ./configure --enable-optimizations # This takes longer to compile
- 5 Using newer versions on CentOS 6
- 6 python_version=3.8.1 # ssl issue may have to use --with-openssl=/path/to/your/local/install
- 7 python_version=3.7.5 # ssl issue
- 8 https://help.dreamhost.com/hc/en-us/articles/360001435926-Installing-OpenSSL-locally-under-your-username
Test
!/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