ubuntu 默认python版本切换

Ubuntu下完美切换Python版,即设置系统默认的python版本(亲测有效)_ubuntu 切换python版本_关彼得的博客-CSDN博客

 

sudo su
update-alternatives --list python

update-alternatives: error: no alternatives for python

update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
#update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
#update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode

update-alternatives --list python
#/usr/bin/python2.7
#/usr/bin/python3.5

update-alternatives --config python

选择数字就会更改默认python版本

posted on 2023-08-04 09:33  WenJXUST  阅读(575)  评论(0编辑  收藏  举报