Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

env: python: No such file or directory when building app with Xcode

When I build/run/archive my app in Xcode (on MacOS 12.3) I encounter this error:

env: python: No such file or directory
Command Ld failed with a nonzero exit code

I think I might have changed something with regard to my python environment while working on a school project or messed something up there. However, I can not figure out what is wrong.

I tried reinstalling Xcode and python (using brew and pyenv). I also relinked python using brew. But I still encounter the same error.

Which python gives the following results:

which python3
-> /usr/local/bin/python3

And in my ~/.zshrc I have the following line:

export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

Any help would be appreciated! If I missed or forgot anything please let me know, I'm quite new to this.

Answer*

Draft saved
Draft discarded
Cancel
4
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Jun 6, 2022 at 22:00
  • 3
    this worked, be sure to add 'sudo' before this command if you're in macOS monterey Commented Aug 13, 2022 at 6:48
  • worked for me without sudo! Commented Jan 19, 2023 at 14:42
  • Doesn't seem to work with Sequoia (Python3 came preinstalled). The -f makes the command run without error, but it doesn't have an effect even after restarting the terminal. In the end I just downloaded the installer directly from the website and installed it fresh. Didn't need to uninstall the old version, seems like it was removed automatically. Now the python and python3 commands both link to 3.13.1 Commented Dec 18, 2024 at 3:25

lang-py

AltStyle によって変換されたページ (->オリジナル) /