#include <Python.h>
the error of this code is 'Python.h' file not found
.
I've installed python by brew
, the results show below. And the path of python already written in to $PATH
MacBook-Pro test % python --version
Python 3.10.8
MacBook-Pro test % brew search python
==> Formulae
app-engine-python python-tk@3.11
boost-python3 python-tk@3.9
bpython python-typing-extensions
gst-python python-yq
ipython python@3.10 ✔
libpython-tabulate python@3.11
micropython python@3.7
ptpython python@3.8
python-build python@3.9
python-gdbm@3.11 reorder-python-imports
python-launcher wxpython
python-lsp-server pythran
python-markdown jython
python-tabulate cython
python-tk@3.10
==> Casks
awips-python mysql-connector-python
If you meant "python" specifically:
It was migrated from homebrew/cask to homebrew/core.
MacBook-Pro test % echo $PATH
/usr/local/opt/python@3.10/libexec/bin:/Users/fanxuezhou/opt/anaconda3/bin:/Users/fanxuezhou/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
If someone can tell me how to use Python.h
in Xcode, or how can I compile the code by command line?
MacBook-Pro test % gcc main.cpp -o test
main.cpp:9:10: fatal error: 'Python.h' file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.