Upgrade Ubuntu 18.4 to Python 3.8

Time:2021-7-14

1. Download the source code

wget <https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz>

2. Decompress

tar -zxvf Python-3.8.0.tgz

3. Switch directory

cd Python-3.8.0

4. Configure the installation environment

./configure --with-ssl --prefix=/usr/local/python3

5. Installation dependency

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus libncursesw5-dev libgdbm-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev

6. make and make install

make
sudo make install

7. Delete soft connection

sudo rm -rf /usr/bin/python3 
sudo rm -rf /usr/bin/pip3

8. New soft connection

sudo ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3

9. Test whether the installation is successful

python3

This work adoptsCC agreementReprint must indicate the author and the link of this article

walt-white-zhou