ubuntu升级Python版本

一、已有Python版本

1.使用以下命令查找系统上所有安装的 Python 版本

ls /usr/bin/python*

2.使用以下命令更改 Python 3 的符号链接

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

 3.使用以下命令检查 Python 3 符号链接的当前版本

python3 --version

二、下载所需版本

1. 使用以下命令安装软件包

sudo apt-get update
sudo apt-get install software-properties-common

2.添加 deadsnakes PPA 存储库,该存储库包含最新的 Python 版本

sudo add-apt-repository ppa:deadsnakes/ppa

3.安装 Python 3.10

sudo apt install python3.10

4.更新 Python 3 的符号链接,以便将其设置为默认版本

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1

4.使用以下命令更改默认 Python 3 版本

sudo update-alternatives --config python3

该命令将显示所有可用的 Python 3 版本。输入所选版本的编号并按 Enter 键

5. 使用以下命令检查 Python 3 符号链接的当前版本

python3 --version

相关文章

文章浏览阅读2.3k次,点赞4次,收藏22次。最近安装了CARLA预...
文章浏览阅读6.3k次,点赞5次,收藏15次。在清华镜像中下载U...
文章浏览阅读5k次。linux环境, python3.7.问题描述: 安装...
文章浏览阅读4.2k次,点赞4次,收藏17次。要安装这个 standa...
文章浏览阅读894次,点赞51次,收藏31次。在安卓使用vscode主...