(1)anaconda安装python2.7方式,下载Anaconda(https://www.continuum.io/downloads),下载完成之后,cd进入下载文件所在的目录:
$ bash Anaconda2-4.0.0-Linux-x86_64.sh
(2)安装完成之后,在~/.bashrc文件末尾添加Anaconda的库文件(注意“=”两边不要有空格),具体如下:
$ sudo gedit ~/.bashrc
export PATH="/home/jeson/anaconda2/bin:$PATH"
export LD_LIBRARY_PATH="/home/jeson/anaconda2/lib:$LD_LIBRARY_PATH"
(3)重启电脑之后,在命令行输入:ipython,就可以看到python的版本。
9、caffe配置
(1)下载caffe源码:
git clone https://github.com/BVLC/caffe.git //从github上git caffe
(2)安装配置:
cd caffe //打开到刚刚git下来的caffe
cp Makefile.config.example Makefile.config //make指令只能make Makefile.config
(3)配置文件修改
sudo gedit Makefile.config #打开Makefile.config文件 根据个人情况修改文件:
a)若使用cudnn,则将
#USE_CUDNN := 1
修改成:
USE_CUDNN := 1
b)启用Intel Parallel Studio XE 2016
BLAS := mkl
c)配置路径,实现caffe对Python和Matlab接口的支持
PYTHON_LIB := /usr/local/lib
MATLAB_DIR := /usr/local/MATLAB/R2016b
d)若使用的opencv版本是3的,则将
#OPENCV_VERSION := 3
修改为:
OPENCV_VERSION := 3
e)若要使用python来编写layer,则将
#WITH_PYTHON_LAYER := 1
修改为:
WITH_PYTHON_LAYER := 1
f)重要的一项:将
# Whatever else you find you need goes here. 下面的
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
修改为:
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 /usr/lib/x86_64-linux-gnu/hdf5/serial
这是因为Ubuntu16.04的文件包含位置发生了变化,尤其是需要用到的hdf5的位置,所以需要更改这一路径。
h)若安装Anaconda,则
注释掉原来的PYTHON_INCLUDE,使用ANACONDA的配置,
注意文件的
ANACONDA_HOME := $(HOME)/anaconda
可能需要改为
ANACONDA_HOME := $(HOME)/anaconda2
根据自己的情况
#PYTHON_INCLUDE := /usr/include/python2.7 \
# /usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := $(HOME)/anaconda2
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python2.7 \
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
#PYTHON_LIB := /usr/lib
PYTHON_LIB := $(ANACONDA_HOME)/lib
(4)修改makefile文件
打开makefile文件,做如下修改:
将:
NVCCFLAGS +=-ccbin=$(CXX) -Xcompiler-fPIC $(COMMON_FLAGS)
替换为:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
(5)编辑/usr/local/cuda/include/host_config.h
将其中的第115行注释掉,将