目录

python3版本之间的切换

目录

python3版本之间的切换

需求:python3.8切换到python3.10

解决:

  1. 查看系统已存在的所有python版本
ls /usr/bin/python*

显示有python3.8和3.10两个版本

https://i-blog.csdnimg.cn/blog_migrate/fc65774cd6632009da3c406749fcda39.png

  1. 使用update-alternatives管理多个版本的Python
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --config python3

https://i-blog.csdnimg.cn/blog_migrate/650dd572d800a9c856fda167d11bb72a.png 最开始看错,以为是3.10.1 不是这样,最后的1和2是参数

https://i-blog.csdnimg.cn/blog_migrate/f8c8a4ddfe3f862f9e1a83ec40172180.png