caffe安装ubuntu16.04 opencv2.4.13 anaconda2

环境:ubuntu16.04,有GPU

显卡驱动安装

两种安装方式,第一种如下:

选择附加驱动,点击后会有如下窗口弹出
这里写图片描述
上面一项选择使用英伟达驱动,下面一项未知驱动为cpu带的集成显卡选择下面的选项:不用这个设备,选完以后一定要点击”Apply Changes”也就是“应用改变”的按钮(右边的按钮)。
这里写图片描述
安装完成以后要重启一下系统,然后在bash里面输入:
nvidia-settings
显示如下结果表示安装成功,你可以在下面查看你的驱动版本
这里写图片描述

方案二:如果方案一行不通,可以自行安装驱动,

从NVIDIA官网上下载驱动:http://www.nvidia.cn/Download/index.aspx?lang=cn
选择自己需要的版本和驱动,然后点击旁边绿色按钮“搜索”:

#1、下载完成,打开终端,先删除旧的驱动:
sudo apt-get purge nvidia*  
#2、 禁用自带的 nouveau nvidia驱动 (很重要!)通过如下命令创建一个文件
sudo vim /etc/modprobe.d/blacklist-nouveau.conf  
#在文件内添加如下内容:
blacklist nouveau  
options nouveau modeset=0 
#更新一下
sudo update-initramfs -u  
#修改后需要重启系统。确认下Nouveau是已经被你干掉,使用命令: 
lsmod | grep nouveau 
#3、 重启系统至init 3(文本模式),也可先进入图形桌面再运行init 3进入文本模式,再安装下载的驱动就无问题,首先我们需要结束x-window的服务,否则驱动将无法正常安装
#Alt+Ctrl+F1 和 Alt+Ctrl+F7 进行切换
#关闭X-Window
sudo service lightdm stop 
#切换到tty1控制台
Alt+Ctrl+F1
#3 执行如下命令开始安装
sudo ./NVIDIA.run  (NVIDIA 你的驱动,可能直接输入这个命令就可以执行安装?)
#我的是 NVIDIA-Linux-x86_64-375.20.run
#4 安装完成后重新启动X-Window
sudo service lightdm start  
#Ctrl+Alt+F7进入图形界面
#如果安装后驱动程序工作不正常,使用下面的命令进行卸载:
sudo sh ~/NVIDIA-Linux-x86_64-367.44.run --uninstall 
#5 检查是否安装成功,过程跟第一种方案一样,输入
nvidia-smi 
nvidia-settings

系统软件源设置并安装依赖包
流程,分别操作:系统设置(system settings)—->软件与更新(software & update)—–>选择Ubuntu软件(Ubuntu software)选项卡。 来改变系统软件源为阿里的源。
这里写图片描述

#更新列表,打开终端输入如下命令
sudo apt-get update  
#软件源更新完毕后,安装一些必要的依赖包,命令如下:
#与caffe安装的依赖基本上是重复的地方
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libboost-all-dev libopenblas-dev liblapack-dev libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev 

cuda 安装

前言:一定要搞清楚你自己的显卡要装什么版本的驱动,以及支持的cuda版本。

下载地址为:https://developer.nvidia.com/cuda-downloads,然后根据自己的需要选择下载文件
这里写图片描述
下载的是 cuda_8.0.44_linux.run
GCC降级——->由文章的最开始,我们可以知道cuda8.0目前仅支持gcc5.3而ubuntu16.04自带的gcc版本为gcc5.4,所以要降级。

#先查看你是否需要降级GCC
gcc -v 
#如果你的版本是5.3.1以下的就不用降级了,否则要降级gcc。
#下载gcc5.3.0,下载地址为:
# https://pan.baidu.com/s/1cL2v62,
#下载好后,进入到该文件目录,执行如下操作:
sudo tar -zxvf gcc-5.3.0.tar.gz  
#进入到gcc目录:
cd gcc-5.3.0/ 
#下载依赖项(网络不好的话可能慢点,慢慢等吧):
sudo ./contrib/download_prerequisites  
#新建一个编译的文件夹,并进入该文件夹:
sudo mkdir build  
cd build/ 
#生成makefile文件:
sudo ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib  
#编译,编译过程有点长,请耐心等待:
sudo make -j4
#编译结束以后,我们就可以执行安装了:
sudo make install 
#查看是否成功
gcc --version 
g++ --version  

这里写图片描述
这里写图片描述

安装cuda

gcc降到5.3之后,可以直接来安装了cuda了,进到你下载好的cuda-8.0的run文件目录,运行如下命令:

sudo ./cuda_8.0.44_linux.run

这时便进入的声明的界面,你可以连续按Ctr+f向下阅读直到结尾,也可以按Ctr+C跳过阅读,直接到选择接受与否的位置
输入接受:accept; 然后回车。
具体应该怎么输入请按照如下图片的指示来操作,原因:第一次不安装的是英伟达驱动,因为我们之前已经安装过了,第二次不安装是更新,也不用安,安装了麻烦。
这里写图片描述
从上图可是,下载的例子里面是缺少一些支持库的,现在我们安装这些库:

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev  

从上图可以看出来,有一个特别注意,所以我们做如下配置:打开.bashrc来进行配置,命令如下

sudo vim ~/.bashrc 
#并将如下的几行内容复制的到.bashrc文件的最下面
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}} 
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}  
export CUDA_HOME=/usr/local/cuda 

这里写图片描述
然后设置环境变量和动态链接库,在命令行输入:

###########
#前面~/.bashrc里面加入就可以了。 
#/etc/profile 加东西,可能导致进入不了ubuntu。
#sudo vim /etc/profile
#在打开的文件末尾加入:
#export PATH=/usr/local/cuda/bin:$PATH 
############
#保存之后,创建链接文件:
sudo gedit /etc/ld.so.conf.d/cuda.conf  
#在打开的文件中添加如下语句:
/usr/local/cuda/lib64  
#然后执行如下命令使得链接立即生效:
sudo ldconfig 

现在重启电脑!
现在就开始测试一下看看cuda是否安装成功吧!输入如下命令打开测试的代码位置:

cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery 
#编译这些代码:
sudo make -j4  
#执行代码
./deviceQuery  

如果出现如下结果—显卡的配置信息,恭喜你,这就证明你成功的安装了cuda
这里写图片描述

cudnn安装

cuDNN深度学习加速的一些库。

下载地址为:https://developer.nvidia.com/cudnn
这里写图片描述
这里写图片描述
下载后解压

tar -xvf cudnn-8.0-linux-x64-v5.1.tgz  
#  执行如下操作:
sudo cp /usr/local/cuda/include/cudnn.h /usr/local/cuda/include/  
sudo cp /usr/local/cuda/include/lib* /usr/local/cuda/lib64/  

环境:ubuntu16.04, 无GPU

opencv 安装

参考:
Ubuntu16.04+Cuda8.0(gtx1060)+OpenCV2.4.13+anaconda2+caffe详细配置
http://blog.csdn.net/leijiezhang/article/details/53688157

opencv下载: http://opencv.org/releases.html
选用opencv2.4.13
流程,分别操作:系统设置(system settings)—->软件与更新(software & update)—–>选择Ubuntu软件(Ubuntu software)选项卡。 来改变系统软件源为阿里的源。

#更新列表,打开终端输入如下命令
sudo apt-get update  
#移除不必要项目
sudo apt autoremove

#安装一些必须的依赖库
sudo apt install build-essential cmake libgtk2.0-dev pkg-config python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev
unzip opencv-2.4.13.zip  
cd opencv-2.4.13
mkdir opencv-build
cd opencv-build

要是中途出现了一些问题是与cuda有关的,打开opencv下面那个cmakelist文件把with_cuda设置为OFF,如下图,之后再cmake,再编译。
这里写图片描述

#开始编译
#sudo cmake ..
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
#sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_TIFF=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..

#之所以会加上-D BUILD_TIFF=ON是因为看网上有人说如果不加上在编译caffe的时候会有这样的错误/usr/lib/libopencv_highgui.so.2.4: undefined reference to XXXXXX,因为以后会用到caffe所以就没管其他的就直接加上去了,免得到时候在出错.

然后

sudo make install

#环境变量配置
sudo gedit ~/.bashrc
#不建议用下面的
#sudo gedit /etc/profile  
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH 
#执行下列命令, 使环境变量立即生效
#source /etc/profile  
#设置lib库路径,打开文件
sudo gedit /etc/ld.so.conf.d/opencv.conf  
#opencv的库一般安装在’/usr/local/lib’文件夹下,在文件内添加
/usr/local/lib 
#执行下列命令使之立刻生效
sudo ldconfig 

经过上面的流程,这样就可以在eclipse里或者qtcreator里用opencv了。 不过要配置号相应的路径和lib文件。
验证是否安装成功

cd opencv-2.4.13/samples/c  
./build_all.sh  
./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg  

参考:python Anaconda2安装OpenCV2
http://blog.csdn.NET/u012005313/article/details/52985203
可以先添加清华源,再继续安装:
conda config –add channels ‘https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
然后可以直接安装:
conda install opencv

anaconda安装

anaconda下载: 清华镜像源
https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

sudo ./Anaconda2-4.2.0-Linux-x86_64.sh  
#输入回车键之后会有一段长长的须知,一直按Ctr+F直到须知展示完毕,然后输入yes继续执行
#我的默认路径 /home/zdc/anaconda2
sudo vim ~/.bashrc
#添加在下方
export PATH=/home/zdc/anaconda2/bin:$PATH
#重启终端,进行验证
anaconda -V 

matlab安装

ubuntu16.04安装matlab2016b
http://blog.csdn.net/darren2015zdc/article/details/74857372
ubuntu 16.04, caffe, matlab2016b 安装
http://blog.csdn.net/darren2015zdc/article/details/74892901

caffe安装

参考: http://caffe.berkeleyvision.org/install_apt.html
参考:http://blog.csdn.net/v_july_v/article/details/53086367

#安装Git命令:
sudo apt-get install git

#安装General dependencies
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler  
sudo apt-get install --no-install-recommends libboost-all-dev  

#安装BLAS命令: install ATLAS by sudo apt-get install libatlas-base-dev or install OpenBLAS by sudo apt-get install libopenblas-dev or MKL for better CPU performance.
##或者ATLAS
sudo apt-get install libatlas-base-dev
##或者OpenBLAS
sudo apt-get install libopenblas-dev

#安装其他依赖项目:
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

#安装pycaffe接口所需的依赖项:这步可以不着急
#Python (optional): if you use the default Python you will need to sudo apt-get install the python-dev package to have the Python headers for building the pycaffe interface.
sudo apt-get install -y Python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags cython ipython

#或者下载caffe-master后
cd caffe-master/python
for req in $(cat requirements.txt); do pip install $req; done
cd caffe 
sudo cp Makefile.config.example Makefile.config 
sudo vim Makefile.config 
sudo make all -j4
sudo make test -j4
sudo make runtest -j4

参考: Ubuntu16:cmake生成Makefile编译caffe过程(OpenBLAS/CPU+GPU)塈解决nvcc warning:The ‘compute_20’, ‘sm_20’
http://blog.csdn.net/10km/article/details/61619573
执行一下 ,没尝试呢

cmake -DBLAS=Open -DCUDA_NVCC_FLAGS=--Wno-deprecated-gpu-targets ..

之前单独使用python 安装,在caffe/python。 可以直接运行。

#验证
cd caffe-master/python
python
import caffe

这个问题的原因是: anaconda的bin 没有设置正确导致。

python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory
compilation terminated.
Makefile:509: recipe for target 'python/caffe/_caffe.so' failed

安装anaconda后,出现下列问题

zdc@zdc-pc:~/Downloads$ cd caffe-master/python/
zdc@zdc-pc:~/Downloads/caffe-master/python$ python
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
  File "caffe/pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /home/zdc/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by caffe/_caffe.so)

第一次尝试, 用anaconda编译 失败

/usr/lib/x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21'
#...............省略
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/test_net.bin' failed
make: *** [.build_release/tools/test_net.bin] Error 1

第二次尝试:

先使用python进行编译,然后修改anaconda的配置,进行

make pycaffe 仍然出现

>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
  File "caffe/pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /home/zdc/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by caffe/_caffe.so)

原因:造成这个问题的主要原因在于使用make进行编译,导致import caffe时找不到静态链接库.
参考:python caffe libcaffe.so.1.0.0-rc3: cannot open shared object file
http://blog.csdn.net/thesby/article/details/50791469

参考:编译安装caffe
http://blog.csdn.net/u010734277/article/details/70195043
需要conda install libgcc
但出现下列问题(截取部分):

CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda2
# You don't appear to have the necessary permissions to install packages
# into the install area 'C:\Program Files\Anaconda2'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=C:\Program Files\Anaconda2

这里因为 权限的原因。
之前的anaconda 的环境在~/.bashrc 中设置。只对当前用户起作用。
切换到root用户,不起作用。
我切换到root用户后, 在~/.bashrc 中设置 anaconda 的环境,完成安装。
安装后,最好改回来。 因为运行python 命令,anaconda就把自带的python给覆盖了。可能影响其他程序。
使用临时环境设置也是可以的,更安全些。

#先设置临时环境
export PATH=/home/zdc/anaconda2/bin:$PATH
#再安装libgcc
conda install libgcc 

然后,在caffe-master/python 下,就可以了。

>>> import caffe
/home/zdc/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
  File "caffe/pycaffe.py", line 15, in <module>
    import caffe.io
  File "caffe/io.py", line 8, in <module>
    from caffe.proto import caffe_pb2
  File "caffe/proto/caffe_pb2.py", line 6, in <module>
    from google.protobuf.internal import enum_type_wrapper
ImportError: No module named google.protobuf.internal
#Python caffe报错:No module named  google.protobuf.internal
#我装的是anaconda2, 解决方法是在其中安装protobuf最新版本
sudo chmod 777 -R anaconda2
conda install protobuf

进入jupyter notebook

zdc@zdc-pc:~/Downloads/caffe-master/python$ cd ~
zdc@zdc-pc:~$ jupyter notebook

如下所示:

#方法一:
#这部分代码就是先切换到caffe的python目录,然后导入caffe库,然后在切换回原来目录.
import os
caffe_root = "Downloads/caffe-master"
caffe_path = os.path.join(caffe_root + "/python")
caffe_path
#'Downloads/caffe-master/python'

old_path = os.getcwd()
print (old_path)
#caffe_root = "caffe-master"
os.chdir(caffe_root + "/python")
import caffe
os.chdir(old_path)
#/home/zdc

#方法二:
#是使用cmake进行编译:
cd caffe-master
mkdir build
cd build
cmake ..
#这样编译后如果要在python中使用caffe,只需要将caffe的python目录添加到sys.path之中即可:
import sys
caffe_root = "Downloads/caffe-master"
sys.path.append(caffe_root + "/python")
import caffe

参考:python caffe libcaffe.so.1.0.0-rc3: cannot open shared object file
http://blog.csdn.net/thesby/article/details/50791469

参考:
conda 使用清华大学开源软件镜像
http://blog.csdn.net/u010570551/article/details/54291507
Ubuntu16.04 +cuda8.0+cudnn+caffe+theano+tensorflow配置明细
http://www.cnblogs.com/xujianqing/p/6142963.html
Caffe中的Makefile.config的一些说明
http://blog.csdn.net/jiajunlee/article/details/52068230

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
 USE_CUDNN := 1
"CuDNN是NVIDIA专门针对Deep Learning框架设计的一套GPU计算加速库,用于实现高性能的并行计算,在有GPU并且安装CuDNN的情况下可以打开即将注释去掉。"

# CPU-only switch (uncomment to build without GPU support).
#CPU_ONLY := 1
"表示是否用GPU,如果只有CPU这里要打开"

# uncomment to disable IO dependencies and corresponding data layers
USE_OPENCV := 1
"因为要用到OpenCV库所以要打开,下面这两个选项表示是选择Caffe的数据管理第三方库,两者都不打开 Caffe默认用的是LMDB,这两者均是嵌入式数据库管理系统编程库。"
# USE_LEVELDB := 0
# USE_LMDB := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
#   You should not set this flag if you will be reading LMDBs with any
#   possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1
"当需要读取LMDB文件时可以取消注释,默认不打开。"

# Uncomment if you're using OpenCV 3
#OPENCV_VERSION := 2.4.10
OPENCV_VERSION := 2
"用pkg-config --modversion opencv命令查看opencv版本"

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++
"linux系统默认使用g++编译器,OSX则是clang++。"

# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
"CUDA的安装目录"
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
        -gencode arch=compute_20,code=sm_21 \
        -gencode arch=compute_30,code=sm_30 \
        -gencode arch=compute_35,code=sm_35 \
        -gencode arch=compute_50,code=sm_50 \
        -gencode arch=compute_50,code=compute_50
"这些参数需要根据GPU的计算能力
(http://blog.csdn.net/jiajunlee/article/details/52067962)来进行设置,6.0以下的版本不支持×_50的计算能力。"

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := open
"如果用的是ATLAS计算库则赋值atlas,MKL计算库则用mkl赋值,OpenBlas则赋值open。"

# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
#BLAS_INCLUDE := /usr/local/OpenBlas/include
#BLAS_LIB := /usr/local/OpenBlas/lib
"blas库安装目录"

# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib
"如果不是安装在标准路径则要指明"

# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
 MATLAB_DIR := /usr/local/MATLAB/R2016b
# MATLAB_DIR := /Applications/MATLAB_R2012b.app
"matlab安装库的目录"

# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 \
        /usr/lib/python2.7/dist-packages/numpy/core/include
"python安装目录"
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ANACONDA_HOME := $(HOME)/anaconda
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
        # $(ANACONDA_HOME)/include/python2.7 \
        # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

# Uncomment to use Python 3 (default is Python 2)
# PYTHON_LIBRARIES := boost_python3 python3.5m
# PYTHON_INCLUDE := /usr/include/python3.5m \
#                 /usr/lib/python3.5/dist-packages/numpy/core/include

# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
<font color="green">python库位置</font>
# PYTHON_LIB := $(ANACONDA_HOME)/lib

# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib

# Uncomment to support layers written in Python (will link against Python libs)
WITH_PYTHON_LAYER := 1

# 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

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1

# N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0
"所用的GPU的ID编号"

# enable pretty build (comment to see full commands)
Q ?= @

猜你喜欢

转载自blog.csdn.net/darren2015zdc/article/details/73838675
今日推荐