PyCaffe 构建失败,lboost_python 未找到

PyCaffe build fails, lboost_python not found

我使用的是 MacOS 10.13.3 (17D47) Python 2.7.14。我正在构建带有 python 的咖啡。该项目仅 CPU。我可以通过 make run test 构建 caffe,但是,在尝试 make pycaffe 之后我得到了一个错误。这是结果:

touch python/caffe/proto/__init__.py
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
PROTOC (python) src/caffe/proto/caffe.proto
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);           \
                             ^
1 warning generated.
ld: library not found for -lboost_python
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [python/caffe/_caffe.so] Error 1

我有一个 Makefile.config 从 brew install 调用 boost-python 设置为:

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/local/Cellar/boost-python/1.67.0/lib

我的两个初始问题是: 1)难道我不能link使用系统python到boost库吗? 2)告诉make抢boost-python的正确方法是什么?

转到 Makefile(而不是 .config 文件)并将 ld 库的名称更改为 python27。

我实际上遇到了同样的问题,几天都找不到任何答案。但是,我发现了这个问题: .

这个问题是针对 python3 的,但我使用的是 python2.7 。基本上,我进入了 Makefile(不是 Makefile.config),搜索 boost_python,并将其更改为 boost_python27。我执行了以下步骤:

  1. vim Makefile
  2. use vim command :?boost_python(应该只出现 1 次)
  3. changed PYTHON_LIBRARIES ?= boost_python python2.7 to PYTHON_LIBRARIES ?= boost_python27 python2.7
  4. 运行命令sudo make pycaffe

希望对您有所帮助!