'exec: "python": executable file not found in $PATH on Arduino IDE

So I'm trying to run this really simple code on my LCD display, using an ESP32. When I compile the code in the Arduino IDE I get no errors. But, when I try to upload it, I get the following error:

exec: "python": executable file not found in $PATH
Error compiling for board DOIT ESP32 DEVKIT V1.

I'm running the Mac OS Monterey, on an M1 MacBook Air.

I did find some information here, but it wasn't what I was looking for, it was made for Ubuntu. I do have python3 installed on my Mac but it goes to /usr/bin/python3 and Mac automatically installs python, I want python3 to go to /usr/bin/python Running which python returns python not found which is weird, because python should be preinstalled on Mac. Any ideas how to fix this error, and is my way possible?

Thanks!



Solution 1:[1]

python2 has been removed in MacOs Monterey 12.3. So the proper way is to reinstall python2 if you have an application that needs it. But in case that your current script would work with python3 you may try add a symlink. But you need to add in /usr/local/bin

sudo ln -s /path/to/python3 /usr/local/bin/python

Solution 2:[2]

Try this:

sudo ln -s `which python3` /usr/local/bin/python

or

sudo ln -s /usr/bin/python3 /usr/local/bin/python

MAC OS doesn't allow for symlinks in /usr/bin so you have to put the symlink in /usr/local/bin instead.

Solution 3:[3]

Probably a soft link will do, try sudo ln -s /usr/bin/python3 /usr/bin/python

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pedram Tadayoni
Solution 2 Dada
Solution 3 balun