How to install the Python development headers on Mac OS X?
Question:
For a project using Boost.Python (see this other question) I need the Python development headers containing e.g. pyconfig.h
.
These are apparently missing from my system. I’ve installed Python 3 via Homebrew:
cls ~ $ brew info python3
python3: stable 3.3.0
http://www.python.org/
Depends on: pkg-config, readline, sqlite, gdbm
/usr/local/Cellar/python3/3.2.3 (4420 files, 78M)
/usr/local/Cellar/python3/3.3.0 (4843 files, 93M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/python3.rb
I would prefer getting the headers via Homebrew, too, but I cannot find a package for them.
cls ~ $ brew search python-dev
No formula found for "python-dev". Searching open pull requests...
What are my options for installing these headers? Is there a Homebrew package?
Answers:
Are these the headers you are looking for:
Cellar/python3/3.3.0//Frameworks/Python.framework/Versions/3.3/include/python3.3m/
The latest Python 3 formula links a program called python3-config
. You can use it to find the headers like this:
python3-config --include
On my machine, this outputs:
-I/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/include/python3.3m -I/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/include/python3.3m
You may need to brew update && brew rm python3 && brew install python3
to enable this.
There is an equivalent program called python-config
for Python 2.
For a project using Boost.Python (see this other question) I need the Python development headers containing e.g. pyconfig.h
.
These are apparently missing from my system. I’ve installed Python 3 via Homebrew:
cls ~ $ brew info python3
python3: stable 3.3.0
http://www.python.org/
Depends on: pkg-config, readline, sqlite, gdbm
/usr/local/Cellar/python3/3.2.3 (4420 files, 78M)
/usr/local/Cellar/python3/3.3.0 (4843 files, 93M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/python3.rb
I would prefer getting the headers via Homebrew, too, but I cannot find a package for them.
cls ~ $ brew search python-dev
No formula found for "python-dev". Searching open pull requests...
What are my options for installing these headers? Is there a Homebrew package?
Are these the headers you are looking for:
Cellar/python3/3.3.0//Frameworks/Python.framework/Versions/3.3/include/python3.3m/
The latest Python 3 formula links a program called python3-config
. You can use it to find the headers like this:
python3-config --include
On my machine, this outputs:
-I/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/include/python3.3m -I/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/include/python3.3m
You may need to brew update && brew rm python3 && brew install python3
to enable this.
There is an equivalent program called python-config
for Python 2.