Unable to set default python version to python3 in ubuntu

后端 未结 19 1751
遥遥无期
遥遥无期 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 02:00

    At first, Make sure Python3 is installed on your computer

    Go to your terminal and type:

    cd ~/ to go to your home directory

    If you didn't set up your .bash_profile yet, type touch .bash_profile to create your .bash_profile.

    Or, type open -e .bash_profile to edit the file.

    Copy and save alias python=python3 in the .bash_profile.

    Close and reopen your Terminal. Then type the following command to check if Python3 is your default version now:

    python --version

    You should see python 3.x.y is your default version.

    Cheers!

提交回复
热议问题