如何在Mac OS X上安装Python开发头文件?

时间:2013-04-10 16:24:56

标签: python macos header homebrew

对于使用Boost.Python的项目(请参阅this other question),我需要包含以下内容的Python开发标题: pyconfig.h

我的系统显然遗漏了这些。我通过Homebrew安装了Python 3:

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

我更喜欢通过Homebrew获取标题,但我找不到它们的包。

cls ~ $ brew search python-dev
No formula found for "python-dev". Searching open pull requests...

我可以选择安装这些标头吗?有自制软件包吗?

2 个答案:

答案 0 :(得分:18)

最新的Python 3公式链接了一个名为python3-config的程序。您可以使用它来查找这样的标题:

python3-config --include

在我的机器上,输出:

-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

您可能需要brew update && brew rm python3 && brew install python3才能启用此功能。

Python 2有一个名为python-config的等效程序。

答案 1 :(得分:9)

这些是您正在寻找的标题:

Cellar/python3/3.3.0//Frameworks/Python.framework/Versions/3.3/include/python3.3m/
相关问题