写在前面,建议python为2.7
1.确认已经安装brew
2.下载安装 CMake
3.安装依赖
for x in snappy leveldb gflags glog szip hdf5 lmdb homebrew/science/opencv;
do
brew uninstall x;brewinstall–fresh−vd x;
done
brew uninstall –force protobuf; brew install –with-python –fresh -vd protobuf
brew uninstall boost boost-python; brew install –fresh -vd boost boost-python
4.安装caffe
git clone https://github.com/BVLC/caffe.git
cd caffe
cp Makefile.config.example Makefile.config
5.修改配置文件
1、CMakeCache.txt 将off 改为 on
2、CaffeConfig.cmake 将off 改为 on
mkdir build
cd build
cmake ..
6.Make
make all
make runtest
make pytest
这里可能会报错,根据提示安装依赖库即可
注意:如果报错pydot 需要先brew install graphviz 再pip install pydot
7.添加路径
移动caffe
mkdir ~/python
cd caffe
mv /python/caffe ~/python
添加
vim ~/.bash_profile
export PYTHONPATH=~/python:$PYTHONPATH
source .bash_profile