caffe编译报错:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
Makefile:582: recipe for target '.build_release/tools/caffe.o' failed
make: *** [.build_release/tools/caffe.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
from /usr/include/boost/python/args.hpp:8,
from /usr/include/boost/python.hpp:11,
from src/caffe/layer_factory.cpp:4:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
这应该是缺少python头文件,我使用的是系统自带的python3.5,在Makefile.config中对python的配置如下:
PYTHON_LIBRARIES := boost_python3 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5 \
/usr/local/lib/python3.5/dist-packages/numpy/core/include
仔细查了之后发现/usr/include/python3.5 路径并不存在,查了半天终于找到了答案,通过安装python3-dev可以解决
python-dev是干什么用的呢:
linux发行版通常会把类库的头文件和相关的pkg-config分拆成一个单独的xxx-dev(el)包.
以python为例, 以下情况是需要python-dev的:
你需要自己安装一个源外的python类库, 而这个类库内含需要编译的调用python api的c/c++文件。
你自己写的一个程序编译需要链接libpythonXX.(a|so)
(注:以上不含使用ctypes/ffi或者裸dlsym方式直接调用libpython.so)
其他正常使用python或者通过安装源内的python类库的不需要python-dev.