【问题标题】:PyCaffe build fails, lboost_python not foundPyCaffe 构建失败,找不到 lboost_python
【发布时间】:2018-04-21 23:52:15
【问题描述】:

我在 MacOS 10.13.3 (17D47) 上使用 Python 2.7.14。我正在使用 python 构建 caffe。该项目仅是 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)我不允许使用系统python链接到boost库吗? 2)告诉make抓取boost-python的正确方法是什么?

【问题讨论】:

    标签: python macos caffe boost-python


    【解决方案1】:

    我实际上遇到了同样的问题,几天都找不到任何答案。但是,我发现了这个问题:Build caffe with Python ( cannot find -lboost_python3 )

    这个问题是针对 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

    希望对你有帮助!

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 在 Makefile 我有:PYTHON_LIBRARIES ?= boost_python python2.7 我应该删除'。' ?谢谢你的知识。
      • 这是对我有用的 Python_Libraries 配置:PYTHON_LIBRARIES ?= boost_python27 python2.7
      猜你喜欢
      • 2016-06-14
      • 1970-01-01
      • 2015-08-28
      • 2020-11-10
      • 2015-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多