Because some work needs, so need to install Caffe, next, tell everyone about my installation process.
First of all, install the necessary libraries, these are nothing, is the terminal to run the following command, of course, network.
sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf- Compilersudo apt-get install--no-install-recommends libboost-all-devsudo apt-get Install libatlas-base-devsudo apt-get install python-devsudo apt-get install Libgflags-dev Libgoogle-glog-dev Liblmdb-dev
Next, download Caffe
Install the Download tool first
sudo apt-get install git
Then download the Caffe package
git clone https://github.com/BVLC/caffe.git
Enter the Caffe directory
CD caffe/
into the inside of the PYTHON folder , and then enter
for in $ (cat requirements.txt); do pip install $req; Done
The problem arises here: Requirements.txt: no file or directory
Solution:
Pip Freeze >-R requirements.txt
It's good to create a copy.
Installing Caffe
CP Makefile.config.example Makefile.config
First, open the Makefile.config file, incpu_only: = 1the front#to remove. (because only inCPUrun downCaffe)
then,in which the following is found, two paths to change to this:(Add the following twoHdf5the path, otherwise compile timesHdf5Error)
# Whatever Else you find your need goes here.
Include_dirs: = $ (python_include)/usr/local/include/usr/include/hdf5/serial
library_dirs: = $ (python_lib)/usr/local/lib/usr/lib/usr/lib/x86_64- Linux -gnu/hdf5/serial
If you want to install Caffe in python3.5 again, under this folder will
Python_include: =/usr/include/python2.7 \
/usr/local/lib/python2.7/dist-packages/numpy/core/include with #, and at the same time,
Python_include: =/usr/include/python3.5m \
/usr/lib/python3.5/dist-packages/numpy/core/include before the # number can be removed.
Make it below
Make Pycaffe
This part has a problem, I myself is two kinds of solutions have tried the last to work, we all try the best.
question: fatal error:numpy/arrayobject.h No that file or directory
solution: sudo Apt-get install python-numpy
no more, no .在
Makefile.config
找到
PYTHON_INCLUDE
,发现有点不同:
< Span lang= "en-US" >python_include: =/usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
< Span style= "COLOR: #c7254e" >local
PYTHON_INCLUDE:= /usr/include/python2.7 \
/usr/local/lib/python2.7/dist-packages/numpy/core/include
再
makepycaffe
就
ok
了
Then continue make
Make Allmake Testmake runtest
Configuration python
sudo pip install-r python/requirements.txt
Next is the test
installed, I hope to help everyone.
ubuntu16.04 Installation Caffe