Preface: Caffe official website installs the Caffe when involves the thing to be more and disorderly, actually some things can ignore.
Steps:
The mac10.12 itself comes with a python2.7 that can be used by the system's own python
1. Install Homebrew:
Enter Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) in terminal
2. Install some dependent libraries needed for Caffe, enter the following lines in the terminal in turn
brew install -vd snappy leveldb gflags glog szip lmdb# need the homebrew science source for OpenCV and hdf5brew tap homebrew/sciencebrew install hdf5 opencv
# with Python pycaffe needs dependencies built from source
brew install --build-from-source --with-python -vd protobuf
brew install --build-from-source -vd boost boost-python
3. The Blas,caffe description (below) that is required to install the Caffe (below) is the Accelerate/veclib Framework that you can choose to use with your Mac, and you can choose Openblas and MKL. I didn't get the whole accelerate/veclib Framework, I chose to install Openblas.
Blas:already installed as the Accelerate/veclib Framework. Openblas and MKL is alternatives for faster CPU computation.
Download the Openblas source code and compile and install to the/usr/local directory:
Tar xvf openblas-0.2.19.tar.gz
CD OpenBLAS-0.2.19
make
make PREFIX=/usr/local install
Here, all the libraries that Caffe need to rely on are installed and started to install Caffe
4. Installing Caffe
Perform the following lines in the terminal:
git clone https://github.com/BVLC/caffe
cd /Users/XXX/caffe #caffe的
cp Makefile.config.example Makefile.config
You need to modify the Makefile.config file:
1. Remove the Cpu_only: = 1 Comment So that the Caffe can only run on the CPU
2. Change the configuration of the Blas
# BLAS Choice:
# Atlas for Atlas (default)
# MKL for MKL
# Open for Openblas
BLAS: = Open
# Custom (Mkl/atlas/openblas) include and Lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
Blas_include: =/usr/local/include
Blas_lib: =/usr/local/lib
Then execute on the terminal:
make all
make test
make runtest
If the Caffe installation is successful, it will appear as follows:
caffe:mac10.12 Steps to install Caffe