我将按照这篇tutorial介绍如何使用Python进行简单的人脸识别。本教程依赖于我正在尝试安装的dlib库。但是,dlib库依赖于Boost库,并产生以下错误:
-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6.dylib (found suitable version "3.6.0", minimum required is "3.4")
-- *****************************************************************************************************
-- 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下载文件夹运行./bootstrap.sh --with-libraries=python时,我得到以下错误:
darwin.compile.c++ bin.v2/libs/python/build/darwin-4.2.1/release/threading-multi/numeric.o
In file included from libs/python/src/numeric.cpp:6:
In file included from ./boost/python/numeric.hpp:8:
In file included from ./boost/python/detail/prefix.hpp:13:
./boost/python/detail/wrap_python.hpp:50:11: fatal error: 'pyconfig.h' file not found
# include <pyconfig.h>
^
1 error generated.
"g++" -ftemplate-depth-128 -O3 -Wall -dynamic -gdwarf-2 -fexceptions -Wno-inline -fPIC -arch x86_64 -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DNDEBUG -I"." -I"/Users/mikkeld/anaconda/include/python3.5" -c -o "bin.v2/libs/python/build/darwin-4.2.1/release/threading-multi/numeric.o" "libs/python/src/numeric.cpp"我在这里有点迷路了,试着四处看看,但没有运气。有人能发现问题出在哪里吗?
发布于 2020-04-09 00:59:06
感谢你的这个解决方案和上面的一个,我找到了我的python的包含链接,通过:打开你的终端并运行: python --version
替换当前Python版本的3.7并运行:
python3.7-config --includes --libs链接:
/Users/<username>/.pyenv/versions/3.6.7/Python.framework/Versions/3.6/include/python3.6m并替换了我在下面的C_INCLUDE_PATH中找到的链接
编辑/etc/profile,并将以下内容追加到文件中,您应该修改用于指定Python头的路径
C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include/python3.6m
export C_INCLUDE_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/python3.6m
export CPLUS_INCLUDE_PATH
Source /etc/profile重新编译它现在编译boost!
发布于 2019-03-07 00:42:31
这就是那些使用Anaconda的人的答案。
打开终端并运行:
python --version
替换当前Python版本的3.7并运行:
python3.7-config --includes --libs
-I/home/victor/anaconda3/include/python3.7m -I/home/victor/anaconda3/include/python3.7m -lpython3.7m -lpthread -ldl -lutil -lrt -lm
现在,获取返回的第一个项目,并在~/.bashrc上添加以下行
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/home/victor/anaconda3/include/python3.7m"生成新的bashrc文件
source ~/.bashrc_profile
发布于 2018-02-02 00:47:38
我在编译boost时也遇到了这个问题,以下是我的解决方案。
配置文件编辑/etc/
C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include/python3.6m
导出C_INCLUDE_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/python3.6m
再次导出CPLUS_INCLUDE_PATH
它对我很有效,希望你也是。
https://stackoverflow.com/questions/42839382
复制相似问题