python官网下载3.10.0的包解压,Python3.10.0
cd Python-3.10.0
sudo ./configure --enable-optimizations?

sudo make altinstall??

python3.10 --version

?python版本切换:
whereis python3

可看到Python.3.8和python3.10路劲不一致
使用update-alternatives,添加python路径到可选列表(#最后的“1、2、3”是优先级)
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 ?????

sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 2

查看python列表:
update-alternatives?--list python

切换所需版本,输入数字即可
sudo update-alternatives --config python

参考:ubuntu16.04多版本Python任意切换(亲测有效)_zbr794866300的博客-CSDN博客?
|