Ubuntu16.04 CPU下caffe环境搭建

:~$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler

:~$ sudo apt-get install --no-install-recommends 

:~$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

:~$ sudo apt-get install libatlas-base-dev

:~$ sudo apt-get install python-dev

:~$ sudo apt install git

:~$ git clone https://github.com/BVLC/caffe.git

:~$ cd caffe
:~/caffe$ cp Makefile.config.example Makefile.config
:~/caffe$ gedit Makefile.config
:~/caffe$ sudo apt-get install python-pip
:~/caffe$ cd python
:~/caffe/python$ for req in $(cat requirements.txt); do pip install $req; done
:~/caffe/python$ cd ..
:~/caffe$ sudo pip install -r python/requirements.txt
:~/caffe$ cd python
:~/caffe/python$ gedit requirements.txt
:~/caffe/python$ cd ..
:~/caffe$ sudo pip install -r python/requirements.txt
:~/caffe$ gedit Makefile.config
:~/caffe$ sudo pip install -r python/requirements.txt
:~/caffe$ sudo apt-get install gfortran
:~/caffe$ cd ./python
:~/caffe/python$ for req in $(cat requirements.txt); do pip install $req; done
:~/caffe/python$ cd ..
:~/caffe$ sudo pip install -r python/requirements.txt
:~/caffe$ sudo python -m pip install --upgrade --force pip 
:~/caffe$ sudo pip install -r python/requirements.txt
:~/caffe$ make pycaffe
:~/caffe$ sudo apt-get install python-numpy
:~/caffe$ make pycaffe

报错:./include/caffe/common.hpp:4:32: fatal error: boost/shared_ptr.hpp: 没有那个文件或目录

解决:出现该错误的原因是少了依赖:sudo apt-get install --no-install-recommends libboost-all-dev

:~/caffe$ make all

:~/caffe$ make test

:~/caffe$ make runtest

:~/caffe$ cd python
:~/caffe/python$ sudo echo export PYTHONPATH="~/caffe/python" >> ~/.bashrc
:~/caffe/python$ source ~/.bashrc
:~/caffe/python$ cd ..
:~/caffe$ cd ..
:~$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>>

参考
https://blog.csdn.net/muzilinxi90/article/details/53673184

https://www.cnblogs.com/ygh1229/p/6528134.html

你可能感兴趣的:(深度学习,深度学习,caffe)