美文网首页
ubuntu升级Python版本

ubuntu升级Python版本

作者: tzktzk1 | 来源:发表于2023-12-14 18:18 被阅读0次

一、已有Python版本

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

ls /usr/bin/python*
image.png

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

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

sudo update-alternatives --config python3

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

image.png

相关文章

网友评论

      本文标题:ubuntu升级Python版本

      本文链接:https://www.haomeiwen.com/subject/eikwgdtx.html