相关疑难解决方法(0)

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

对于使用Boost.Python的项目(请参阅此另一个问题),我需要包含例如的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
Run Code Online (Sandbox Code Playgroud)

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

cls ~ $ brew search python-dev
No formula found for "python-dev". Searching open pull requests...
Run Code Online (Sandbox Code Playgroud)

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

python macos homebrew header

28
推荐指数
2
解决办法
4万
查看次数

OS X cmake找不到PythonLibs 3.4

python和python3通过Homebrew安装在OS X Yosemite中,但是cmake无法找到PythonLibs 3,只有2:


的CMakeLists.txt:

set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp REQUIRED)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
Run Code Online (Sandbox Code Playgroud)

得到:

-- Found PythonInterp: /usr/local/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4")
-- Found PythonLibs: /usr/lib/libpython3.4.dylib (found version "2.7.6"
Run Code Online (Sandbox Code Playgroud)

的CMakeLists.txt:

set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp 3.4 REQUIRED)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
Run Code Online (Sandbox Code Playgroud)

得到:

Could NOT find PythonLibs: Found unsuitable version "2.7.6", but required
is at least "3.4" (found PYTHON_LIBRARY-NOTFOUND)
Run Code Online (Sandbox Code Playgroud)


然后我将其添加到cmake列表:

INCLUDE_DIRECTORIES(/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib)
INCLUDE_DIRECTORIES(/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/include/python3.4m)
Run Code Online (Sandbox Code Playgroud)

甚至将目录复制到/usr/lib,然后得到:

Could NOT find PythonLibs: Found unsuitable version "2.7.6", but required
is at least "3.4" (found /usr/lib/libpython3.4.dylib) …
Run Code Online (Sandbox Code Playgroud)

python macos cmake python-3.x

10
推荐指数
1
解决办法
3042
查看次数

标签 统计

macos ×2

python ×2

cmake ×1

header ×1

homebrew ×1

python-3.x ×1