在os x上编译dlib时出错

Error compiling dlib on os x

本文关键字:dlib 出错 编译 os      更新时间:2023-10-16

我正试图在我的计算机(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

我已经用上述解决方案解决了无法找到Boost的问题。