1. 不要卸载Ubuntu自带的Python2.7和Python3.5,直接安装新版本的Python,然后修改默认的Python软链接即可。
2.安装Python3.8
- 1) 安装依赖包
- 2)添加 deadsnakes PPA 源
- 3) 安装 python 3.8
报错:
解决方法:
3.采用update-alternatives 切换版本
- 3.1 查看update-alternatives的帮助信息:update-alternatives --help
- 3.2 查看有没有python可选项:update-alternatives --display python
- 3.3 如果没有,输入下面的命令建立python可选项
- 3.4 切换python版本:sudo update-alternatives --config python
There are 3 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/python3.8 3 auto mode
1 /usr/bin/python2.7 2 manual mode
* 2 /usr/bin/python3.5 1 manual mode
3 /usr/bin/python3.8 3 manual mode
Press <enter> to keep the current choice[*], or type selection number: 3