python - 在 os x 上编译 dlib 时出错

标签 python c++ cmake dlib

我正在尝试在我的计算机 (OS X 10.10) 上编译 dlib,但遇到错误我不确定如何修复。当我运行 CMake 时,我得到了这个输出

Configuring cmake ...
-- The C compiler identification is AppleClang 7.0.0.7000176
-- The CXX compiler identification is AppleClang 7.0.0.7000176
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Boost
-- Boost version: 1.59.0
-- Found the following Boost libraries:
--   python
CMake Error at /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find PythonLibs: Found unsuitable version "2.7.10", but required
  is at least "3.4" (found PYTHON_LIBRARY-NOTFOUND)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindPythonLibs.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /Users/gabriel/Devspace/dlib/dlib/add_python_module:64 (FIND_PACKAGE)
  CMakeLists.txt:6 (include)
-- Configuring incomplete, errors occurred!
See also "/Users/gabriel/Devspace/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
error: cmake configuration failed!

首先,我想知道 CMake 是如何找不到 Boost 的,但在下一行给出了我目前在我的计算机上安装的 boost 版本?其次,我想知道如何修复 pythonlibs 错误?我试过谷歌搜索,但主要只是发现其他人有类似的错误,但不知道它的含义或如何修复它。任何帮助将不胜感激。谢谢

最佳答案

你的 boost 是用 python 3 安装的吗?如果是这样,我建议你设置默认的 python 版本 3.x,或者像这样用当前的 python 版本重新安装 boost:

To compile Boost.Python yourself download boost from boost.org and then go into the boost root folder and run these commands:
./bootstrap.sh --with-libraries=python
./b2
sudo ./b2 install

我已经用上述解决方案解决了Could NOT find Boost的问题。

关于python - 在 os x 上编译 dlib 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33725724/

相关文章:

Python请求SSL错误不一致

c++:这个插入表达式是做什么的,当作为函数参数传递时它是如何工作的?

c++ - gcc 没有正确链接到 gsoap

windows - 如何使用 CMake 为多配置生成器和基于 makefile 的生成器获取目标文件的路径?

python - 我可以使用 Turbogears 开发移动网站吗?

python - 为什么我的静态文件没有加载到 django 中?

Python:解析 SGML

c++ - 我如何最好地对 N 值的(一维) vector 进行强制展平?

c++ - 替代 C++ 异常

c++ - 如何使用 Bison 和 CMake 生成 C++ 文件来生成树?