[Python] trying to build electron app but getting Exit code: ENOENT. spawn /usr/bin/python...

Discussão em 'Python' iniciado por Stack, Junho 29, 2025.

  1. Stack

    Stack Membro Participativo

    When building my electron app with electron-builder after running npm run electron:build, the internal script always calls the hardcoded path /usr/bin/python. On my Apple Silicon Mac, this Python path is missing, causing the build to fail or behave incorrectly. I want to force the build to use my preferred Python at /opt/homebrew/bin/python3. It is actually where my python is. But whatever I did I could not change the address electron builder is referring to.

    What I tried:

    • Setting the DMGBUILD_PYTHON env variable to point to my Python — no effect.
    • Editing config or build scripts — but the path is hardcoded inside the package.
    • Creating a symlink at /usr/bin/python pointing to my Python — this didn't work even after disabling system protection (SIP), which is unsafe.
    • Manually patching the hardcoded path in the package’s code — works but gets overwritten on reinstall.[​IMG]

    Continue reading...

Compartilhe esta Página