Ubuntu 怎样升级 python3.7

  1. 使用 apt-get 安装 python3.7
sudo apt-get install python3.7
  1. 将python3.6 或 python 3.7添加到 update-alternatives
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
  1. 将 python3 指向 python3.7
sudo update-alternatives --config python3

输入python3.7对应的序号,回车即可

  1. 测试
$ python3 --version
Python 3.7.5