caffe 安装报错解决办法

 

sudo apt install caffe-cuda --fix-missing

make -j8 && make pycaffe

sudo apt  install protobuf-compiler

sudo apt-get install libgoogle-glog-dev

1.caffe/blob.hpp:9:34: fatal error: caffe/proto/caffe.pb.h: 没有那个文件或目录

protoc src/caffe/proto/caffe.proto --cpp_out=.

mkdir include/caffe/proto

mv src/caffe/proto/caffe.pb.h include/caffe/proto

2..build_release/src/caffe/proto/caffe.pb.h:9:10: fatal error: google/protobuf/stubs/common.h: No such file or directory

protoc --version
libprotoc 3.0.0

caffe需要protoc版本为2,ProtoBuf 2.6.1安装、配置、卸载

https://blog.csdn.net/blue_it/article/details/53996216

sudo ln -s usr/local/bin/protoc /usr/bin/protoc

3.src/caffe/data_transformer.cpp:2:10: fatal error: opencv2/core/core.hpp: No such file or directory

https://blog.csdn.net/u014587123/article/details/88430503   opencv安装

修改makefile.config中

#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 /opt/Opencv2/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/Opencv2/lib


4.src/caffe/layers/hdf5_data_layer.cpp:13:10: fatal error: hdf5.h: No such file or directory

apt-get install libhdf5-serial-dev

 

5../include/caffe/util/db_leveldb.hpp:7:10: fatal error: leveldb/db.h: No such file or directory

git clone https://github.com/google/leveldb

 

6../include/caffe/util/db_lmdb.hpp:8:10: fatal error: lmdb.h: No such file or directory

apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

 

7.nvcc fatal   : Unsupported gpu architecture 'compute_20'
Makefile:594: recipe for target '.build_release/cuda/src/caffe/layers/absval_layer.o' failed

在Makefile.config文件中根据自己CUDA的版本注释不同的行。

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := #-gencode arch=compute_20,code=sm_20 \
                #-gencode arch=compute_20,code=sm_21

                -gencode arch=compute_30,code=sm_30 \
                -gencode arch=compute_35,code=sm_35 \
                -gencode arch=compute_50,code=sm_50 \
                -gencode arch=compute_52,code=sm_52 \
                -gencode arch=compute_60,code=sm_60 \
                -gencode arch=compute_61,code=sm_61 \
                -gencode arch=compute_61,code=compute_61

 

8./usr/bin/ld: cannot find -lleveldb
/usr/bin/ld: cannot find -lsnappy
/usr/bin/ld: cannot find -lcblas
/usr/bin/ld: cannot find -latlas
collect2: error: ld returned 1 exit status

apt-get install libleveldb-dev
apt-get install libsnappy-dev

sudo apt-get install libatlas-base-dev

 

9..build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status

在Makefile.config文件中取消注释   OPENCV_VERSION := 3

 

10.python/caffe/_caffe.cpp:10:10: fatal error: numpy/arrayobject.h: No such file or directory

sudo apt-get install python-numpy

 

11./usr/bin/ld: cannot find -lpython3.6

/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/(libpython3.6.so所在文件夹)添加到Makefile.config文件中

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/Opencv2/lib /usr/lib/x86_64-linux-gnu /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/(libpython3.6.so所在文件夹)

 

12./usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromFormat'
/usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_InPlaceDivide'

cd /usr/lib/x86_64-linux-gnu/
sudo rm libboost_python.so
sudo ln -s libboost_python-py36.so libboost_python.so
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值