一、更新apt镜像源
ubuntu18.04提供了界面更新镜像源。操作如图:
UbuntuSofeware->DownloadFrom->Other
二、安装编译python包所需要的的工具
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
三、下载编译安装Python
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -zxvf Python-3.8.0.tgz
cd Python-3.8.0
./configure --enable-optimizations
make -j 8
sudo make altinstall
python3.8 --version