mac安装caffe

2018-08-0521:53:46

以前经常用windows平台,最近换了mac平台。这是一个mac下安装caffe的教程

 1     brew install opencv3 --with-contrib --with-ffmpeg --with-tbb --with-qt5 --with-python
 2     export OpenCV_DIR=/usr/local/Cellar/opencv3/3.1.0_1/share/OpenCV
 3     echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth
 4     brew link opencv3 --force
 5  
 6     #高性能矩阵计算,数值运算库
 7     brew install openblas
 8     #不加可能不会在/usr/local/include(bin) 中创建openblas的link,导致查找不到cblas.h的错误
 9     brew link openblas --force
10  
11     brew install szip
12  
13     #谷歌开发的混合语言数据标准,序列化
14     #直接用动态库opencv和caffe链接到同一个动态protocol库会出错
15     git clone https://github.com/google/protobuf.git
16     cd protobuf
17     git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock
18     cd gmock
19     git clone -b release-1.7.0 https://github.com/google/googletest.git gtest
20     cd ../cmake
21     mkdir build
22     cd build
23     cmake -DBUILD_SHARED_LIBS=OFF ..
24     make -j4
25     make install
26     cd ../../python
27     python setup.py build
28     python setup.py test
29     python setuppy install
30  
31     #brew install --build-from-source --with-python -vd protobuf
32  
33     #谷歌开发的日志系统
34     brew install glog
35  
36     #谷歌开源的处理命令行参数的库
37     brew install gflags
38  
39     #层次型的数据存储格式,包含了数据定义和支持接口
40     brew install hdf5
41  
42     #caffe需要使用的智能指针等来自boost库,还有python调研c++的借口也由boost实现
43     brew install --build-from-source -vd boost boost-python
44  
45     #一些nosql的数据库,caffe的数据存储
46     brew install lmdb
47     brew install snappy
48     brew install leveldb  <pre name="code" class="plain">    git clone https://github.com/BVLC/caffe.git
49     cd caffe
50  
51     #安装python caffe
52     for req in $(cat python/requirements.txt); do pip install $req; done
53     echo "if import caffe failed with segment fault, check the python lib link, you should link local python lib manully"
54     mkdir build
55     cd build
56     #mac dose not support cuda, use cpu only
57     cmake -DCPU_ONLY=ON ..
58     make all
59     make install
60     make runtest
原文地址:https://www.cnblogs.com/RM-Anton/p/9427492.html