安装caffe的python接口,即运行 make pycaffe 时出现以下问题:
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
In file included from python/caffe/_caffe.cpp:17:
In file included from ./include/caffe/caffe.hpp:12:
./include/caffe/net.hpp:41:5: warning: unused typedef 'INVALID_REQUESTED_LOG_SEVERITY' [-Wunused-local-typedef]
LOG_EVERY_N(WARNING, 1000) << "DEPRECATED: ForwardPrefilled() "
^
/usr/local/include/glog/logging.h:943:30: note: expanded from macro 'LOG_EVERY_N'
INVALID_REQUESTED_LOG_SEVERITY); \
^
python/caffe/_caffe.cpp:379:1: warning: unused typedef 'assertion' [-Wunused-local-typedef]
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SolveOverloads, Solve, 0, 1);
^
/usr/local/include/boost/python/detail/defaults_gen.hpp:375:5: note: expanded from macro 'BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS'
BOOST_PYTHON_GEN_MEM_FUNCTION_STUB( \
^
/usr/local/include/boost/python/detail/defaults_gen.hpp:276:9: note: expanded from macro 'BOOST_PYTHON_GEN_MEM_FUNCTION_STUB'
BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args + 1, n_dflts) \
^
/usr/local/include/boost/python/detail/defaults_gen.hpp:216:46: note: expanded from macro 'BOOST_PYTHON_OVERLOAD_CONSTRUCTORS'
N,n_args>::too_many_keywords assertion; \
^
python/caffe/_caffe.cpp:379:1: warning: unused typedef 'assertion' [-Wunused-local-typedef]
/usr/local/include/boost/python/detail/defaults_gen.hpp:375:5: note: expanded from macro 'BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS'
BOOST_PYTHON_GEN_MEM_FUNCTION_STUB( \
^
/usr/local/include/boost/python/detail/defaults_gen.hpp:276:9: note: expanded from macro 'BOOST_PYTHON_GEN_MEM_FUNCTION_STUB'
BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args + 1, n_dflts) \
^
/usr/local/include/boost/python/detail/defaults_gen.hpp:225:46: note: expanded from macro 'BOOST_PYTHON_OVERLOAD_CONSTRUCTORS'
N,n_args>::too_many_keywords assertion; \
^
3 warnings generated.
ld: library not found for -lboost_python3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [python/caffe/_caffe.so] Error 1
解决:
终于在github上找到了解决方案,问题原因应该是我安装的是python3.7,虽然安装了对应boost版本,但在Makefile.config文件中PYTHON_LIBRARIES变量还是被注释状态,修改为以下表达式再运行make pycaffe成功:
PYTHON_LIBRARIES := boost_python37 python3.7m