https://www.python.org/ftp/python/

download

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

decompression

 tar -xf Python-3.9.5.tgz cd Python-3.9.5

Compile Install

 ./configure && make && make install

Wait patiently...

Check whether the version is installed successfully

 python3 -V

Establish soft connection

After compilation, the program is usually installed in /usr/local/bin lower
Python - V If the version is not displayed, create a soft link, and it will take effect globally
Soft connection

 ln -s /usr/local/bin/python3.9 /usr/bin/python ln -s /usr/local/bin/python3.9-config /usr/bin/python-config

The pip command reports an error

-bash: pip: command not found

Solution (Centos Version)

Download pip script

 wget  https://bootstrap.pypa.io/get-pip.py

Python executes pip script installation

 python3 get-pip.py

View pip version

 pip -V

Uninstall Python 3

 rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps

Delete all residual files

 whereis python3 |xargs rm -frv

View existing installed Python

 whereis python
End