Install dependency packages
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev
sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
sudo apt-get install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev
Find the corresponding version from the Python web page and click to download it.
sudo wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
Third, extract the
sudo tar -zxvf Python-3.7.3.tgz
Unzip it and enter the generated directory python-3.7.3
cd Python-3.7.3
Install and compile Python
sudo ./configure && sudo make && sudo make install
6. After installation, create/modify the existing soft connection.
create soft connection (first time)
sudo ln -f /usr/local/bin/python3.7 /usr/bin/python
sudo ln -f /usr/local/bin/pip3.7 /usr/bin/pip
Modify the soft connection (more than once)
sudo ln -sf /usr/local/bin/python3.7 /usr/bin/python
sudo ln -sf /usr/local/bin/pip3.7 /usr/bin/pip
Seven, print version test
python3 -V
pip3 -V
success