brew install -vd snappy leveldb gflags glog szip lmdb brew tap homebrew/science brew install hdf5 opencv brew install protobuf boost
git clone https://github.com/BVLC/caffe.git cd caffe make all && make test && make runtest
問題一:python
in file included from src/caffe/common.cpp:7: In file included from ./include/caffe/common.hpp:19: ./include/caffe/util/device_alternate.hpp:34:10: fatal error: 'cublas_v2.h' file not found #include <cublas_v2.h> ^~~~~~~~~~~~~ 1 error generated.
解決方案:
設置Makefile.config中取消註釋CPU_ONLY := 1前面的註釋git
問題二:github
./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: 'cblas.h' file not found #include <cblas.h>
解決方案:
第1步:brew install homebrew/science/openblas
第2步:
修改Makefile.config文件中BLAS:= atlas爲BLAS := OpenBlas
修改Makefile.config文件中BLAS的庫或頭文件:
BLAS_INCLUDE := /usr/local/opt/openblas/include
BLAS_LIB := /usr/local/opt/openblas/libshell
問題三:xcode
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'. /bin/sh: line 0: [: -gt: unary operator expected /bin/sh: line 0: [: -gt: unary operator expected LD -o .build_release/lib/libcaffe.so.1.0.0 clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument] ld: framework not found vecLib clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
解決方案:
在命令行中輸入:xcode-select --installapp
make pycaffe
問題一:ui
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp python/caffe/_caffe.cpp:10:10: fatal error: 'numpy/arrayobject.h' file not found #include <numpy/arrayobject.h> ^~~~~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [python/caffe/_caffe.so] Error 1
解決方案:
第1步:brew install numpy
第2步:spa
修改Makefile.config命令行
去掉註釋code
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include # PYTHON_LIB += $(shell brew --prefix numpy)/lib
變爲
PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include PYTHON_LIB += $(shell brew --prefix numpy)/lib
問題二:
ld: library not found for -lboost_python clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [python/caffe/_caffe.so] Error 1
解決方案:
brew install boost-python
安裝caffe的python依賴:cd pythonfor req in $(cat requirements.txt); do pip install --user $req; done