Unable to set default python version to python3 in ubuntu

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

    EDIT:

    I wrote this when I was young an naive, update-alternatives is the better way to do this. See @Pardhu's answer.

    Open your .bashrc file nano ~/.bashrc. Type alias python=python3 on to a new line at the top of the file then save the file with ctrl+o and close the file with ctrl+x. Then, back at your command line type source ~/.bashrc. Now your alias should be permanent.

提交回复
热议问题