How to install the Python development headers on Mac OS X?

让人想犯罪 __ 提交于 2019-12-17 18:16:06

问题


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?


回答1:


Are these the headers you are looking for:

Cellar/python3/3.3.0//Frameworks/Python.framework/Versions/3.3/include/python3.3m/



回答2:


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.



来源:https://stackoverflow.com/questions/15931331/how-to-install-the-python-development-headers-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!