Unable to set default python version to python3 in ubuntu

后端 未结 19 1787
遥遥无期
遥遥无期 2020-11-28 01:38

I was trying to set default python version to python3 in Ubuntu 16.04. By default it is python2 (2.7). I followed below steps :

19条回答
  •  佛祖请我去吃肉
    2020-11-28 01:40

    Set priority for default python in Linux terminal by adding this:

    sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
    sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
    

    Here, we set python3 to have priority 10 and python2 to priority 1. This will make python3 the default python. If you want Python2 as default then make a priority of python2 higher then python3

提交回复
热议问题