1.依赖库安装
$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$ sudo apt-get install --no-install-recommends libboost-all-dev
$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
2,安装科学计算和必要的库
sudo apt-get install openblas-dev numpy scipy matplotlib lapack-dev freetype-dev libpng-dev
3.caffe源码下载
$ git clone https://github.com/BVLC/caffe.git
4.进入caffe/python
目录,并执行以下脚本安装Python依赖包:
for req in $(cat requirements.txt); do pip install $req; done
5.在caffe
目录下,将Makefile.config.example
改名为Makefile.config
:
cp Makefile.config.example Makefile.config
修改makefile文件
将Makefile
文件的下面一行内容:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
更改为:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
执行以下命令:
$ export CPLUS_INCLUDE_PATH=/usr/include/python3.6
然后在caffe
目录下运行以下命令安装Caffe:
make all
安装完成后进行测试:
make test
make runtest