Ubuntu安装caffe

前期

参照链接一步一步走

遇到的其他错误:

错误1

make runtest -j12时,遇到.build_release/tools/caffe: error while loading shared libraries: libcudnn.so.6: cannot open shared object file: No such file or directory

  • 由于用的zsh而不是bash,输入nvcc -V发现找不到nvcc指令,因此通过在终端输入bash换回到bash环境,再运行make runtest -j12,即可解决

错误2

make runtest -j12make pycaffe -j8成功后,在python中import caffe时报错。

  • no module caffe,检查~/bashrc中是否添加了export PYTHONPATH=/home/xxx/caffe/python:$PYTHONPATH
  • ImportError:No module named skimage.io,则通过sudo apt-get install python-skimage安装skimage模块

错误3

caffe安装出现 “error : too few arguments in function call” 的错误

  • 替换caffe-master\include\caffe\util中的”cudnn.hpp”
  • 参考

错误4

2 errors detected in the compilation of “/tmp/tmpxft_0000339c_00000000-19_box_annotator_ohem_layer.compute_61.cpp1.ii”.
Makefile:595: recipe for target ‘.build_release/cuda/src/caffe/layers/box_annotator_ohem_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/box_annotator_ohem_layer.o] Error 1

  • 修改makefile, 319行附近部分改成:(加了-std=c++11)

    ifeq ($(DEBUG), 1)
        COMMON_FLAGS += -DDEBUG -g -O0 -std=c++11
        NVCCFLAGS += -G
    else
        COMMON_FLAGS += -DNDEBUG -O2 -std=c++11
    endif

  目录