Install Python 3.9 on Centos 7 or 8
CentOS has python2.7.5 and python3.6.8 inculded. I'd like to have latest python installed for some new features.
Remove default python3
yum remove python3Install prerequisite packages
yum update -yyum groupinstall -y 'Development Tools'yum install -y gcc openssl-devel bzip2-devel libffi-develDownload python source code
Pyhon source code can be found here(FTP server).
wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xztar zxf Python-3.9.6.tgzcd Python-3.9.6Compile and install
./configure prefix=/usr/local/python3.9makemake installCreate soft links
ln -s /usr/local/python3.9/bin/python3.9 /usr/bin/python3ln -s /usr/local/python3.9/bin/pip3.9 /usr/bin/pip3Verify
python3 --verionpip3 --versionNow we are good to go!
Optional: change pip registry
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simpleor just change registry temperarily:
pip3 install docker-compose -i https://pypi.tuna.tsinghua.edu.cn/simple