将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 - 大象笔记

相关推荐
aqi003 小时前
15天学会AI应用开发(八)使用向量数据库实现RAG功能
人工智能·python·大模型·ai编程·ai应用
Csvn4 小时前
`functools.lru_cache` —— 一行代码搞定缓存加速
后端·python
金銀銅鐵20 小时前
[Python] 从《千字文》中随机挑选汉字
后端·python
cup111 天前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi001 天前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵1 天前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf1 天前
Agent 流程编排
后端·python·agent
copyer_xyf1 天前
Agent RAG
后端·python·agent