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