ubuntu升级Python版本
•
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
![]()
本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://www.net2asp.com/28ce375417.html
