ubuntu16.04+ anaconda3(python3.6) +caffe

1.背景

记录安装caffe, python3.6的坑。 本文安装的cuda8.0, cudnn5.1

1.1.前提已经安装好cuda,cudnn

2。安装caffe依赖,克隆caffe不多说,网上很多资料;现在只关心最关键的Makefile.config和Makefile文件

2.1修改Makefile.config

 USE_CUDNN := 1 取消注释

 OPENCV_VERSION := 3 如果安装opencv3则取消注释


注释掉由于安装anaconda3

#PYTHON_INCLUDE := /usr/include/python2.7 \
# /usr/lib/python2.7/dist-packages/numpy/core/include


对应修改本文安装anaconda3版本Anaconda3-5.0.1-Linux-x86_64  python3.6

 ANACONDA_HOME := $(HOME)/anaconda3
 PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python3.6m \

$(ANACONDA_HOME)/lib/python3.6/site-packages/numpy/core/include

这里需要特别注意,如果是python3.6一定需要修改

 PYTHON_LIBRARIES := boost_python3 python3.6m


同理这里同样取消注释

#PYTHON_LIB := /usr/lib

 PYTHON_LIB := $(ANACONDA_HOME)/lib

WITH_PYTHON_LAYER := 1


ubuntu16.04中这里需要添加(加粗部分为添加内容)

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 /usr/lib/x86_64-linux-gnu/hdf5/serial

到这里Makfile.config修改完成


3.安装过程中遇到错误

3.1 error while loading shared libraries: libpython3.6m.so.1.0 not found

locate  libpython3.6m.so.1.0查找的位置 

查找出来是在anaconda3/lib中

添加:

sudo gedit  /etc/ld.so.conf

/home/path/anaconda3/lib/


3.2 opencv3依赖出错

在makefile中
由 LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
修改为
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 opencv_core opencv_imgproc opencv_imgcodecs opencv_highgui





你可能感兴趣的:(caffe学习)