How to Install Caffe 1.0 With Anaconda Python3 on Centos7

Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by Berkeley AI Research (BAIR) and by community contributors.

The official website is .

It is easy to install it with python 2 and Ubuntu.But it is hard to install it with python 3 and centOs.

Here are some records when I install it with Anaconda python3 on centos7.


Prior to installing, have a glance through this blog and take note of the details for your platform.

$cat /etc/redhat-release

CentOS Linux release 7.*.* (Core)

$python --version

Python 3.4.3 :: Anaconda 2.3.0 (64-bit)

$pip --version

pip 7.0.3 from /home/work/anaconda3/lib/python3.4/site-packages (python 3.4)


$sudo yum install gflags-devel glog-devel lmdb-devel openblas-devel leveldb-devel snappy-devel opencv-devel hdf5-devel

Python and boost Dependencies

Fist of all,download the dependencies.

$git clone --depth 1


$wget ''

$wget ''

Install the dependencies:

1.python libs:

$cd caffe/python

$for req in $(cat requirements.txt) pydot; do /usr/bin/pip install $req -i; done

If you are not in China,remove the -i url parameter.

2.pb libs:

$cd ../..;tar zxvf boost_1_59_0.tar.gz;tar zxvf protobuf-cpp-3.3.0.tar.gz;tar zxvf protobuf-python-3.3.0.tar.gz

$cd protobuf-3.3.0/


$make && make install

$cd python/

$python build

$python install

$sudo ln -s /usr/local/lib/ /usr/lib64/

3.boost libs:

$cd boost_1_59_0/


$./b2 cxxflags="-I /home/work/anaconda3/include/python3.4m/"

$sudo ./b2 install --prefix=/usr cxxflags="-I /home/work/anaconda3/include/python3.4m/"

Install Caffe

The last step:

$cd caffe

$git checkout -b 1.0

$vim Makefile.config

change the config like this:

BLAS := open

BLAS_INCLUDE := /usr/include/openblas

PYTHON_INCLUDE := /home/work/anaconda3/include \
                       /home/work/anaconda3/include/python3.4m \

PYTHON_LIBRARIES := boost_python3 python3.4m


$make pycaffe

$export PYTHONPATH=$PYTHONPATH:/home/work/soft/src/caffe/python


$cd caffe
$make test && make runtest

Good luck!