Exec: "python": executable file not found in $PATH

After updating my Macbook Air into MacOS Monterey 12.3 I get an error "exec: "python": executable file not found in $PATH" when compiling my script. I checked the right python version in the right folder and that is okay. Did several restarts and installed IDE latest version on my Macbook. Still not disappeared.

please help me out if you know the solution

Cheers, Loek

1 Like

https://forum.arduino.cc/t/mac-os-update-killed-esp32-sketch/969580/9

Starting the IDE with the Terminal app works for me:

open /Applications/Arduino1.8.19.app

Termial has command completion so you can type:
open /App[TAB]
Terminal will expand that to:
open /Applications/
You then type Ard[TAB] and that will get expanded to whatever app you have that starts with "Ard".

2 Likes

Thank you!
I tried this several times but it doesn't work in my case...

Thank you!
Walked through the whole issue, but coudn't solve my problems....

Do you have Python 2 installed? What do the commands "which python" and "python -V" produce in Terminal?

1 Like

python 3.10 is installed

That doesn't matter. Python 3 is "python3". You need "python" which is Python 2.

1 Like

silly, but this command doesn't give an answer....
when I use which python3 I get te following result
Library/Frameworks/Python.framework/Versions/3.10/bin/python3

Sounds like you don't have Python 2 installed. You should install it.

2 Likes

Alright, thnx!
Starting to install python2

Were you able to get it to work, @loekpfundt? I ran the OSX installer listed in post #10 but the IDE still failed with the same message:

exec: "python": executable file not found in $PATH
Error compiling for board Adafruit ESP32 Feather.

Thanks.

There is a problem somewhere that keeps the Python 2 install from being on the search path when Arduino is started from Finder. Starting Arduino from Terminal works around the problem.

1 Like

Thanks. I landed on this solution. It feels imperfect, but I’m happy to be able to compile and push my code.

running this command in Terminal.app under your current user

sed -i -e 's/=python /=python3 /g' ~/Library/Arduino15/packages/esp32/hardware/esp32/*/platform.txt

seems to fix it.The command modifies all the platform.txt files under your local installation of the ESP32 tools (~/Library/Arduino15/packages/esp32/hardware/esp32) and replaces the word python by python3 wherever it finds it

(cf Deprecation of Python 2. Solution · Issue #4717 · espressif/arduino-esp32 · GitHub)

17 Likes

That worked for me. Thanks very much!!!!

It worked for me too :grinning:

Glad it helped!

Awesome!

I just spent 4 hours trying to fix this very problem. I just tried your suggestion, and it worked for me too!
Thanks @J-M-L

This worked for me too :raised_hands:t4: