由于机器不是NVIDIA显卡,直接跳过CUDA的安装
用的ATLAS
sudo apt-get install libatlas-base-dev
1. sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev最好一项一项安装,出错时可以知道哪一项失败了
2. glog 和gflags 直接从网上下的压缩包
cd glog-0.3.3 ./configure make && make install
cd gflags-master mkdir build && cd build export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 make && make install
cd mdb/libraries/liblmdb make && make install
相应的,需要手动下载该链接的 gmock ,压缩包放在protobuf内
安装automake工具
sudo apt-get install autoconf automake libtool此时运行 ./autogen.sh 应该不会出错了。接下来make protobuf
./configure make make check make install
-> 下载caffe源文件
-> 修改makefile.config
cp Makefile.config.example Makefile.config因为没有CUDA,将文件中的 CPU_ONLY:=1 和 CUSTOM_CXX:=g++ 解除注释
-> 编译caffe
make all make test make runtest
官网推荐安装Anaconda版本的python,里面集成了需要的包
或者按照 caffe/python/requirements 的内容自己配置python
用的第二种方式:
sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython ipython
sudo apt-get install protobuf-c-compiler protobuf-compiler
make pycaffe
import sys sys.path.append("path/to/caffe/python/") exit()
can’t import symbol_database错误是google.protobuf版本问题导致的:
首先备份 /usr/lib/python2.7/dist-packages/google/descriptor_pb2.py
然后下载protobuf-3.0 alpha,将其 python/google 目录下的所有文件替换到 /usr/lib/python2.7/dist-packages/google/
最后将descriptor_pb2.py 复制回来
再次 import caffe,成功!
参考资料
[1] http://caffe.berkeleyvision.org/installation.html
[2] http://blog.csdn.net/zxd675816777/article/details/39649281
[3] http://bbs.itbookstudy.com/t/12870/1/1
[4] http://blog.csdn.net/huangshanchun/article/details/42083985
[5] http://www.cnblogs.com/sunshineatnoon/p/4535329.html