Python 2 is removed from macOS Monterey but I still have to type the python3 command to execute Python scripts. How can you also allow the 'python' command?

'zsh: command not found: python' after reinstalling Monterey and Python.

I re-installed macOS Monterey and Python. I open the terminal and execute Python. This is the result:

~ $ python -V
zsh: command not found: python

The python3 command works:

bin $ python3 -V
Python 3.10.4

Create a symlink

The solution is to create a symlink

bin $ ls -la
.
.
lrwxrwxr-x   1 root      admin      10 May 29 19:05 python3 -> python3.10
.
.

In here you see a python3 symlink that points to python3.10.

ln -s python3.10 python
~ $ python -V
Python 3.10.4

Voila. You can now use the python command to execute Python 3 scripts.

It works in a virtual environment too:

$ python -m venv env
$ source env/bin/activate
(env) $ python -V
Python 3.10.4
Written by Loek van den Ouweland on 2022-05-29.
Questions regarding this artice? You can send them to the address below.