本文参考文章: ubuntu16.04, Matlab2016b caffe编译安装:https://www.cnblogs.com/haoliuhust/p/7738920.html 官方安装文档:http://caffe.berkeleyvision.org/installation.html Ubuntu16.04安装Caffe(CPU Only):http://blog.csdn.net/muzilinxi90/article/details/53673184
此外还要安装git,cmake
$ sudo apt-get install git $ sudo apt-get install cmakepython 依赖库
$ cd python/ $ apt-get install python-pip $ pip install --upgrade pip $ for req in $(cat requirements.txt); do pip install $req; done在Caffe文件夹下,拷贝一份Makefile.config.example并重命名成Makefile.config,修改该配置文件:
$ cp Makefile.config.example Makefile.config打开Makefile.config(vi Makefile.config),因为这里没有配置GPU,所以去掉CPU_ONLY := 1前面的注释,MATLAB_DIR后改为matlab的安装地址
由于Ubuntu16.04文件结构的变化,#Whatever else you find you need goes here.处要改成下面这样:
# Whatever else you find you need goes here. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial注意: 每条路径之间一定要有空格,否则仍然会报错
接下来编译Caffe
$ make all $ make test $ make runtest进入caffe/python,打开python,输入import caffe,如果没有报错则配置成功