Make python3 as my default python on Mac

后端 未结 4 1494
谎友^
谎友^ 2020-11-30 18:23

What I\'m trying to do here is to make python3 as my default python. Except the python 2.7 which automatically installed on mac, I installed python3

4条回答
  •  情话喂你
    2020-11-30 19:08

    Before we make the changes, the default version of python in my system was python 2.7.17.

    python --version

    Python 2.7.17

    To make python3 as default python by replacing python2 in Ubuntu.

    1. Open Terminal
    2. cd
    3. nano ~/.bashrc
    4. alias python=python3 (Add this line on top of .bashrc file)
    5. Press ctr+o (To save the file)
    6. Press Enter
    7. Press ctr+x (To exit the file)
    8. source ~/.bashrc OR . ~/.bashrc (To refresh the bashrc file)

    python --version

    Python 3.7.5

提交回复
热议问题