ubuntu16.04 Installation Caffe

Source: Internet
Author: User
Tags git clone

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
makepycaffeok

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.