1、安装编译环境
sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev liblzma-dev libffi-dev libc6-dev
2、下载Python-3.7.1.tar.xz
3、解压
tar xvJf Python-3.7.1.tar.xz
4、配置安装位置
./configure --prefix=/usr/bin/python3.7
5、编译及安装
sudo make && sudo make install
6、设置python3.7.1版本为默认python
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3.7/bin/python3.7 /usr/bin/python