I am trying to write Python C extensions and I'm on a mac. I know how to install the Python.h
header file on Linux, but I don't know how to do it on a Mac. How can I install it?
Asked
Active
Viewed 314 times
2

Serket
- 3,785
- 3
- 14
- 45
-
Possibly it depends on your python installation. Maybe you installed it by brew or some package manager, possibly it has some type of "dev" package, too, with the header(s). Note, Python.h is not enough, it likely includes a lot of other headers, what you need is the collection of the headers and the static libraries. This is called "development package" in the Unix world, and "SDK" in the Windows world. – peterh Jun 05 '20 at 10:39
1 Answers
1
The Python header file is a framework on Mac. You have to include it like this:
#include <Python/Python.h>

Serket
- 3,785
- 3
- 14
- 45