MacOS – How to make “python” command in terminal open python3 instead of python2.7 which comes with mac

command linemacospythonterminal

Mac comes with Python2.7.

For a project, I need to use Python3.7.5. I installed it.

However, if I just type python in terminal, the 2.7 interpreter starts.

How do I make it so that when I type python, it opens 3.7.5 interpreter?

Best Answer

Type python3 and you will be running the new version. How you install can vary a bit, but on the current macOS you don’t need to install anything as the stub exists. On any older os I recommend installing https://brew.sh as it has a very friendly on boarding and helps you set your PATH properly to run the v3 of python.

A shell alias is an easy way to fix this permanently.

alias python=python3