When you use homebrew to install Python, it may leave the distribution in the Cellar, and not link the good stuff into the expected /usr/local path locations. If you cannot directly run python from /usr/local/bin/python, then this is likely what has happened, or Xcode doesn't like symlinked content 😕.
If you do not have an executable /usr/local/bin/python, and its library modules are not installed in the /usr/local/lib path, then you may want to do the following to remedy that, only if the preceding was true. See akauppi response in this stackoverflow article.
# the homebrew installed Python, not the System Python
brew link --overwrite python
which python
/usr/local/bin/python
By default, the environment variable PYTHONPATH is set, but empty, and will default to using the System Python library modules. In order to use your brew installed Python, the PYTHONPATH must be set to its /usr/local/lib/python.../lib path, where you are explicit with filling in the ellipsis with the real path components. At any rate, that path will end in /lib . I believe, and may be wrong, that even if you explicitly run /usr/local/bin/python, if the PYTHONPATH environment variable is left to default, that your version of python will attempt to use the System Python libraries.
This information may, or may not be helpful to your particular Xcode issue, as I do not use Python in Xcode.