1. 下载python3.8源码
$ wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
2.安装依赖
$ sudo apt-get install gcc g++ make zlib* libffi-dev openssl libssl-dev
3. 编译安装
$ tar -xf Python-3.8.5.tgz
$ cd Python-3.8.5
$ ./configure --prefix=/opt/python3.8 --with-ssl
$ make -j
$ sudo make install
$ sudo rm -rf /usr/bin/lsb_release
4. 搭建python使用环境
$ cd /usr/bin
$ sudo rm python python3
$ sudo ln -s /opt/python3.8/bin/python3.8 python
$ sudo ln -s /opt/python3.8/bin/python3.8 python3
5. 升级安装pip3
$ sudo apt-get install python3-setuptools python3-pip -y
$ sudo pip3 install --upgrade pip