1.安装好tensorflow-CPU
pip install tensorflow
2.安装依赖库
sudo apt-get update #一定要输入,否则下面命令安装过程报错,不能安装
sudo apt-get install libprotobuf-dev
sudo apt-get install libleveldb-dev
sudo apt-get install libsnappy-dev
sudo apt-get install libopencv-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libboost-all-dev
sudo apt-get install protobuf-compiler
sudo apt-get install libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev
3.安装caffe
cd #重要,默认安装在家目录下
sudo apt-get install git
git clone https://github.com/BVLC/caffe.git
cd /home/*/caffe/
cp Makefile.config.example Makefile.config #复制配置模板,不要在原文件上修改,如果出错,方便重新配置
4.Makefile.config配置
1.将
# CPU_ONLY := 1
改为
CPU_ONLY := 1
2.修改重要的一项,将 Whatever else you find you need goes here下面的
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
修改为:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib/x86_64-linux-gnu/hdf5/serial
5.测试
sudo make all -j4
sudo make test
sudo make runtest