Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
854 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...