一、安装依赖包
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev
sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
sudo apt-get install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev
二、从Python网页中找到相应的版本,点击下载
sudo wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
三、解压
sudo tar -zxvf Python-3.7.3.tgz
四、解压结束 进入生成的目录python-3.7.3
cd Python-3.7.3
五、安装python
sudo ./configure --prefix=/usr/local/python3
sudo make
sudo make install
六、安装完成,创建软连接,打印版本测试
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
python3 -V
pip3 -V
安装结束。