Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 安装dlib时Mac Sierra上的Boost和CMake出现问题_Python_Macos_Boost_Cmake - Fatal编程技术网

Python 安装dlib时Mac Sierra上的Boost和CMake出现问题

Python 安装dlib时Mac Sierra上的Boost和CMake出现问题,python,macos,boost,cmake,Python,Macos,Boost,Cmake,因此,我通过brew安装了Boost,与cmake和python的安装方式类似: brew install boost --with-python3 brew install boost-python brew install cmake 我目前正在使用miniconda3(python3.6)并尝试安装Dlib。到目前为止,我可以很好地安装dlib,但是当涉及到python安装时,它失败了。Dlib可通过克隆repo获得 我在这里安装了python setup.py,得到了以下错误 -- D

因此,我通过brew安装了Boost,与cmake和python的安装方式类似:

brew install boost --with-python3
brew install boost-python
brew install cmake
我目前正在使用miniconda3(python3.6)并尝试安装Dlib。到目前为止,我可以很好地安装dlib,但是当涉及到python安装时,它失败了。Dlib可通过克隆repo获得

我在这里安装了
python setup.py
,得到了以下错误

-- Detecting CXX compile features - done
CMake Warning at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindBoost.cmake:1518 (message):
  No header defined for python-py34; skipping header check
Call Stack (most recent call first):
  /Users/userx/dlib/dlib/cmake_utils/add_python_module:61 (FIND_PACKAGE)
  CMakeLists.txt:6 (include)
-- Could NOT find Boost
CMake Warning at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindBoost.cmake:1518 (message):
  No header defined for python-py35; skipping header check
Call Stack (most recent call first):
  /Users/userx/dlib/dlib/cmake_utils/add_python_module:63 (FIND_PACKAGE)
  CMakeLists.txt:6 (include)
-- Could NOT find Boost
CMake Warning at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindBoost.cmake:1518 (message):
  No header defined for python3; skipping header check
Call Stack (most recent call first):
  /Users/userx/dlib/dlib/cmake_utils/add_python_module:66 (FIND_PACKAGE)
  CMakeLists.txt:6 (include)
-- Boost version: 1.61.0
-- Found the following Boost libraries:
--   python3
-- Found PythonLibs: /Users/userx/miniconda3/lib/libpython3.5.dylib (found suitable version "3.5.2", minimum required is "3.4")
-- USING BOOST_LIBS: /Users/userx/miniconda3/lib/libboost_python3.dylib
-- USING PYTHON_LIBS: /Users/userx/miniconda3/lib/libpython3.5.dylib
...
...
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o] Error 1
make[1]: *** [dlib_build/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!
所以在这里,我觉得cmake找不到boost变量,所以我将它们添加到我的
.bashrc
中,并重新启动了我的shell

export BOOST_ROOT="/usr/local/Cellar/boost/1.63.0"
export BOOST_INCLUDE="/usr/local/Cellar/boost/1.63.0/include"
export BOOST_LIBDIR="/usr/local/Cellar/boost/1.63.0/lib"
注意:这些路径是通过
brew info
找到的,并检查它们以确保正确性

我正在使用macbook和Sierra操作系统,因为我知道Sierra已经改变了很多构建的方式

我也尝试过从网站上删除boost和download并直接构建,但同样的问题依然存在


非常感谢任何帮助

我在我的系统中也做了同样的事情,只是有一点不同:

python3 setup.py install
而不是

python setup.py install

我没有看到这个错误。

它可能是由CMAKE_PREFIX_路径设置引起的

我遇到了同样的问题,我通过以下顺序解决了它:

首先,我使用以下方法安装boost:

brew install boost-python --with-python3
然后,我在运行以下命令安装dlib 19.7.0时发现BOOST Not found错误:

pip install dlib --upgrade
因此,我使用以下命令编辑Bash概要文件:

nano ~/.bash*le
并将以下行添加到此文件中:

export CMAKE_PREFIX_PATH="/usr/local:/usr/local/Cellar/boost/1.65.1:$PATH"
通知 我使用的是boost 1.65.1,安装在
/usr/local/cillar/boost/1.65.1
,您可以将其更改为使用brew安装boost的位置


在这一步之后,我再次在python2.7.14和3.6.1以及3.6.3上运行
pip install dlib--upgrade
,现在一切都正常了。

也许你应该尝试使用
brew安装boost python--python3
,也就是说,使用python 3来增强python,而不仅仅是主增强。你觉得有什么不同吗?