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

相关推荐
郑州光合科技余经理3 小时前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1234 小时前
matlab画图工具
开发语言·matlab
dustcell.4 小时前
haproxy七层代理
java·开发语言·前端
norlan_jame4 小时前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone4 小时前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
欧云服务器4 小时前
怎么让脚本命令可以同时在centos、debian、ubuntu执行?
ubuntu·centos·debian
QQ4022054964 小时前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
百锦再4 小时前
Django实现接口token检测的实现方案
数据库·python·django·sqlite·flask·fastapi·pip
QQ5110082854 小时前
python+springboot+django/flask的校园资料分享系统
spring boot·python·django·flask·node.js·php
QQ_19632884754 小时前
Python-flask框架西山区家政服务评价系统网站设计与开发-Pycharm django
python·pycharm·flask