hmars
hmars

Reputation: 307

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

since the last update to Mac OS Monterey 12.3 I get the following error message when compiling my Arduino sketch:

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

Unfortunately, I have not yet been able to find out how to solve this problem.

I would be very grateful for ideas and suggestions.

Upvotes: 6

Views: 25073

Answers (2)

Jonathan
Jonathan

Reputation: 639

Problem

In MacOS 12.3 Apple removed python2.7 (python) from MacOS.

Solution

What I did to solve this is link python3 to python, I wouldn't recommend it because it's sus, I would recommend you wait until Arduino IDE fixes this issue in a later build. For the time being, you could try their Web IDE: Arduino Editor

However, here are the instructions to link python3 to python:

  1. If you don't have python3 installed, install it here in the link below:

    Python Install Page

  2. Find your path for the current version of python3 you're using

    which python3

    it'll show up with something like this: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3

  3. Copy that and use it to run this command that links python 3 to python. Replace the first file path with where your python3 is.

    ln -s -f INSERT_PATH_OF_PYTHON3 /usr/local/bin/python

    for example:

    ln -s -f /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 /usr/local/bin/python

Upvotes: 16

Zygfryd Homonto
Zygfryd Homonto

Reputation: 181

Four steps are needed:

  1. Install python3 using i.e. Brew:

    brew install python
    

    python3 is in:

    /opt/homebrew/bin/python3
    
  2. Link Python to python3:

    sudo ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python
    
  3. Check if you can execute it from the terminal; i.e.,

    python --version
    

    Irrespective of whether you use python --version or python3 --version, it should show python 3 now.

  4. Open terminal and execute:

    open /Applications/Arduino.app
    

It works in my case. It looks like when Arduino is executed from the GUI, it does not read the $PATH properly, so although python is linked to python3, it does not find it.

Upvotes: 17

Related Questions