Python 3.x 未能在Python中安装Boost-未找到pyconfig.h
下面我将介绍如何使用Python进行简单的人脸识别。本教程依赖于我正在尝试安装的dlib库。但是,dlib库依赖于Boost库,并产生以下错误:Python 3.x 未能在Python中安装Boost-未找到pyconfig.h,python-3.x,boost,dlib,Python 3.x,Boost,Dlib,下面我将介绍如何使用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") -- *******************
-- 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"
代码>达尔文。编译。C++ BIN。V2/LIBS/Python/Bug/DARWEN 4.2.1//多线程/多线程/O线程。
在libs/python/src/numeric.cpp中包含的文件中:6:
在./boost/python/numeric.hpp中包含的文件中:8:
在./boost/python/detail/prefix.hpp:13中包含的文件中:
./boost/python/detail/wrap_python.hpp:50:11:致命错误:“未找到pyconfig.h”文件
#包括
^
生成1个错误。
“g++”-ftemplate-depth-128-O3-Wall-dynamic-gdwarf-2-feexceptions-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”
我在这里有点迷路了,我试着在没有运气的情况下四处看看。有人能发现问题所在吗?我在编译boost时也遇到了这个问题,下面是我的解决方案
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
C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/INCLUDE/python3.6m
导出C_INCLUDE_路径
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/INCLUDE/python3.6m
导出CPLUS\u INCLUDE\u路径这对我来说很有效,希望你能这么做。这是给那些使用蟒蛇的人的答案 打开终端并运行:
python——版本
替换当前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
在Ubuntu 18.04上的anaconda上,我在boost 1.72和python 3.7下使用了一种技术
- 确保您的anaconda环境处于活动状态(路径中的python正确)
- 在boost源代码树中编辑文件
tools/build/src/tools/python.jam
- 查找第547行
includes?=$(前缀)/include/python$(版本)代码>
- 替换为
includes?=$(前缀)/include/python$(版本)m代码>
和/bootstrap.sh
/b2正常安装
python3.7-config --includes --libs
链接:
/Users/<username>/.pyenv/versions/3.6.7/Python.framework/Versions/3.6/include/python3.6m
重新编译
它现在编译boost 尝试:我也有同样的错误,我在MacOS上遵循了这些说明,它似乎已经纠正了我的问题。这是一个感谢信+使用上述两个答案修改的答案