安裝依賴
sudo apt install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt install --no-install-recommends libboost-all-dev
sudo apt install libgflags-dev libgoogle-glog-dev liblmdb-dev libatlas-base-dev
sudo apt install libgflags-dev libblas-dev liblmdb-dev libgflags-dev
編譯
一谈秫、去載源碼
去github 下載
二府蛇、配置
cp Makefile.config.example Makefile.config
如果是CPU模式载迄,則配置為
CPU_ONLY := 1
解決hdf5錯誤問題
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
三悔耘、編譯
依次執(zhí)行命令
make all -j8
make test -j8
make runtest -j8
注意:-j8是指使用8核進行編譯举娩,根據(jù)配置調(diào)整
編譯python接口
一、安裝依賴
sudo apt install python-pip
sudo apt install python-numpy
sudo apt install gfortran
for req in $(cat python/requirements.txt); do pip install $req; done
sudo pip install -r python/requirements.txt
二、編譯
make pycaffe
三、配置環(huán)境變量
export PYTHONPATH=/home/ubuntu/caffe/python:$PYTHONPATH
四娜搂、測試
運行python
>> import caffe
如果沒有報錯,說明caffe安裝全部完成吱抚!