gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 22:12:30 25 4
gpt4 key购买 nike

对于使用 Boost.Python 的项目(参见 this other question),我需要包含例如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 获取 header ,但我找不到它们的包。

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

我有哪些安装这些 header 的选项?有 Homebrew 包吗?

最佳答案

最新的 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 的等效程序。

关于python - 如何在 Mac OS X 上安装 Python 开发头文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15931331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com