【caffe】ubuntu16.04安裝caffe問題記錄

安裝可參考:

  1. ubuntu16.04安裝caffe
  2. https://blog.csdn.net/u012505617/article/details/88532982

1. nvcc fatal : Unsupported gpu architecture ‘compute_20’

nvcc fatal : Unsupported gpu architecture ‘compute_20’
nvcc fatal : Unsupported gpu architecture ‘compute_20’
nvcc fatal : Unsupported gpu architecture ‘compute_20’
nvcc fatal : Unsupported gpu architecture ‘compute_20’

解決
Makefile.configCUDA_ARCH前兩行註釋掉

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

2. /usr/local/include/c++/5.4.0/bits/c++0x_warning.h:32:2: 錯誤:#error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

#error This file requires compiler and library support \

解決
參考自:https://blog.csdn.net/u012505617/article/details/88532982
打開Makefile文件,給CXXFLAGS、NVCCFLAGS、LINKFLAGS都使用-std=c++11標準編譯:

CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) 
改爲:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11 
 
 
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
改爲:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)  -std=c++11
 
 
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
改爲:
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11

3. ImportError: libcaffe.so.1.1.0: cannot open shared object file: No such file or directory

make clean,然後重新編譯了

make all -j8
make pycaffe -j8

4. ImportError: No module named protobuf.internal

pip install protobuf
但是python2不能安裝了。把caffe改爲python3.5的支持。

5. ubuntu16.04安裝caffe,支持python3.5

參考:https://www.cnblogs.com/hanjianjian90/p/10604926.html

1. 注意python3.5支持的地方修改

PYTHON_LIBRARIES := boost_python3-py35 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m \
                /usr/lib/python3.5/dist-packages/numpy/core/include

報錯/usr/bin/x86_64-linux-gnu-ld: 找不到 -lboost_python3-py35

2 . 按https://www.cnblogs.com/hanjianjian90/p/10604926.html建立軟鏈接python3的軟鏈接
https://www.cnblogs.com/hanjianjian90/p/10604926.html
ln -s /usr/local/python3/bin/python3.5 /usr/bin/python3 這是修改默認的python

  1. 報錯
    Makefile:638: recipe for target ‘.build_release/tools/upgrade_net_proto_binary.bin’ failed
    make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1
    .build_release/lib/libcaffe.so:對‘cv::_OutputArray::_OutputArray(cv::Mat&)’未定義的引用
    .build_release/lib/libcaffe.so:對‘cv::_InputArray::_InputArray(cv::Mat const&)’未定義的引用
    .build_release/lib/libcaffe.so:對‘vtable for cv::_InputArray’未定義的引用

把opencv的支持去掉,我編譯的是opencv2,caffe好像要3開始的版本。

  1. import caffe時報錯
    ImportError: No module named ‘google’

pip install protobuf

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章