【Caffe】Mac上Anaconda安装Caffe遇到的各种坑

主要参考安装方法:

https://blog.csdn.net/ddreaming/article/details/52739893

https://medium.com/@buffaloal/build-caffe-with-anaconda-on-macos-1070a8d0a9fe

https://www.jianshu.com/p/0e5c4944f50c


brew install --build-from-source --with-python --fresh -vd protobuf

brew install --build-from-source --fresh -vd boost boost-python


export PATH=/anaconda3/bin:$PATH 
export DYLD_FALLBACK_LIBRARY_PATH=/anaconda3:/usr/local/lib:/usr/lib

git clone https://github.com/BVLC/caffe.git

cd /usr/local/Cellar/caffe
cp Makefile.config.example Makefile.config

for req in $(cat python/requirements.txt); do pip install $req; done

make pycaffe
make distribute

 

PYTHON_LIB和PYTHON_INCLUDE

电脑上Python的安装路劲如下:
/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib
/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7
分别是我电脑Python的lib路径与include路径


//Path to a program.

PYTHON_EXECUTABLE:FILEPATH=/anaconda2/envs/py27/bin/python2.7

//Path to a file.

PYTHON_INCLUDE_DIR:PATH=/anaconda2/envs/py27/include/python2.7

//Path to a library.

PYTHON_LIBRARY:FILEPATH=/anaconda2/envs/py27/lib/libpython2.7.dylib

 

版本不一致:
出现segmentation fault :11解决方法

-- Python:
--   Interpreter       :   /usr/local/bin/python2.7 (ver. 2.7.15)
--   Libraries         :   /usr/lib/libpython2.7.dylib (ver 2.7.10)
--   NumPy             :   /usr/local/lib/python2.7/site-packages/numpy/core/include (ver 1.15.4)
-- 

 

出现错误:
/usr/local/include/google/protobuf/message_lite.h:110:11: error: use of
      undeclared identifier 'union_'
    new (&union_) T();
          ^


解决方法:
open file .../libphonenumber/cpp/build/CMakeCache.txt, find line CMAKE_CXX_FLAGS:STRING= and replace with CMAKE_CXX_FLAGS:STRING=-std=c++11 

-std=c++11 -stdlib=libc++

 

open ~/.bash_profile

export PYTHONPATH=/usr/local/Cellar/caffe/python/:$PYTHONPATH
Could NOT find Boost
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
Python interface is disabled or not all required dependencies found. Building without it...



单独安装Doxygen;
Boost路径改成anaconda下的boost的路径;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值