安装编译所需的类库

sudo apt install libgdm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libbz2-dev libdb-dev libdb++-dev libgdbm-dev libgdbm-dev libffi-dev

下载Python3.8

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

编译配置

./configure --enable-optimizations

编译源码

make -j6

编译安装

sudo -H make altinstall