Machine Learning_安装_caffe

参考:
http://www.tuicool.com/articles/FjAnqin
http://www.bubuko.com/infodetail-847860.html

  • 安装opencv
    由于已经安装了anaconda,有了大量python工具包,故不需要安装hdf5,只需要安装opencv

    brew tap homebrew/science
    brew install opencv
  • 安装Boost和Boost-python 为了之后python接口的编译

    brew install --build-from-source --with-python -vd protobuf
    brew install --build-from-source -vd boost boost-python
  • Python接口:从Github上把Caffe下载下来解压后用命令行进入其中的Python文件夹执行以下命令来安装Python的依赖:

    cd caffe/python
    for req in $(cat requirements.txt); do pip install $req; done
  • 修改Makefile.config

    • 去掉后缀.example

      cp Makefile.config.example Makefile.config
    • 修改

      将 CPU_ONLY := 1 的注释去掉
    • 然后就是后面的Python路径,用Anaconda Python的话将下面的注释去掉:

      ANACONDA_HOME := $(HOME)/anaconda
      PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
              $(ANACONDA_HOME)/include/python3.6m \
              $(ANACONDA_HOME)/lib/python3.6/site-packages/numpy/core/include
  • make

    cd caffe
    make all

    遇到问题:

    fatal error: 'gflags/gflags.h' file not found
    
    #include <gflags/gflags.h>
    

    原因:以为anaconda都有 就没有执行brew install -vd snappy leveldb gflags glog szip lmdb
    重新执行一遍。。。

    brew install -vd snappy leveldb gflags glog szip lmdb

    又出现问题:

    fatal error: 'cblas.h' file not found
    
    #include <cblas.h>
    

    解决:

    brew install openblas

    再解决:
    Go to the Makefile.config and edit the following lines with the path where your openblas is located, in my case the version is 0.2.19_1
    Be sure to uncomment these lines:

    BLAS_INCLUDE := /usr/local/Cellar/openblas/0.2.19_1/include
    BLAS_LIB := /usr/local/Cellar/openblas/0.2.19_1/lib

    再make:

    make 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值