Unable to set default python version to python3 in ubuntu

后端 未结 19 1753
遥遥无期
遥遥无期 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:43

    The second line mentioned can be changed to

    update-alternatives --install /usr/bin/python python /usr/bin/python3 10

    This gives a priority of 10 for the path of python3. The disadvantage of editing .bashrc file is that it will not work while using the commands with sudo.

    Update: Please use sudo while running the command like this:

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

提交回复
热议问题