Scripting >> Python >> How to upgrade to Python 3.9 in Centos 7



yum groupinstall "Development Tools" -y

yum install openssl-devel libffi-devel bzip2-devel -y

wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz

tar xzf Python-3.9.4.tgz

cd Python-3.9.4

./configure --enable-optimizations

make altinstall

python3.9 --version

pip3.9 --version

NOTE: python3.9 and pip3.9 binaries will be found in /usr/local/bin

update the softlinks for python3 and pip3

Currently softllink:

/bin -> /usr/bin
/usr/bin/python3 -> python3.6

Update as follows:

rm -f /usr/bin/python3
ln -s  /usr/local/bin/python3.9 /usr/bin/python3
rm -f /usr/bin/pip3
ln -s /usr/local/bin/pip3.9 /usr/bin/pip3