将Ubuntu18.04默认的python3.6升级到python3.8

1、查看现有的 python3 版本

复制代码
python3 --version

2、安装 python3.8

复制代码
sudo apt install python3.8

3、将 python3.6 和 3.8 添加到 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.8 2

4、将 python3 指向 python3.8

复制代码
sudo update-alternatives --config python3

可以看到,python3 已经默认指向了 python3.8,按回车即可。

5、输入 python3 指令测试一下,可以看到指向已更新到 python3.8。

6、如果以后不使用 python3.8 可以使用如下指令删除

复制代码
sudo apt-get -y purge python3.8
sudo apt-get -y autoremove

至此,python3.6 升级到 python3.8 版本完成。


参考博客:

Ubuntu 升级 Python 3.6 版本到 3.8 - Python - 大象笔记

相关推荐
哈茶真的c25 分钟前
【书籍心得】左耳听风:传奇程序员练级攻略
java·c语言·python·go
沐知全栈开发30 分钟前
ionic 选项卡栏操作详解
开发语言
曹牧39 分钟前
C#中,#region和#endregion
开发语言·c#
顾安r41 分钟前
11.22 脚本打包APP 排错指南
linux·服务器·开发语言·前端·flask
蒙小萌19931 小时前
Swift UIKit MVVM + RxSwift Development Rules
开发语言·prompt·swift·rxswift
io_T_T1 小时前
Paddle-CLS图像分类_环境安装
python·日常软硬件经验分享
Z***25801 小时前
Java爬虫框架
java·开发语言·爬虫
百***48072 小时前
Python使用PyMySQL操作MySQL完整指南
数据库·python·mysql
hateregiste2 小时前
C语言中如何优雅、准确、高效地设计和处理输入输出
c语言·开发语言·scanf·输入输出
SundayBear2 小时前
C语言复杂类型声明完全解析:从右左原则到工程实践
c语言·开发语言·数据结构·嵌入式