CaffeMac上Anaconda安装Caffe遇到的各种坑

Posted Taily老段

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CaffeMac上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的路径;

 

以上是关于CaffeMac上Anaconda安装Caffe遇到的各种坑的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu16.04+matlab2014a+anaconda2+OpenCV3.1+caffe安装

Ubuntu16.04+matlab2014a+anaconda2+OpenCV3.1+caffe安装

Ubuntu16.04+matlab2014a+anaconda2+OpenCV3.1+caffe安装

anaconda 安装caffe,cntk,theano-未整理

anaconda3安装caffe

安装caffe(opencv3+anaconda3)