这篇文章主要介绍了Ubuntu14.04在系统平台(未使用anaconda环境管理)搭建CPU版Caffe,无GPU,详解教程,操作系统是Ubuntu 14.04,本文分步骤给大家介绍的非常详细,具有参考借鉴价值,需要的朋友可以参考下.
操作系统:
Ubuntu 14.04
PYTHON版本:2.7,使用python3会有各种包依赖问题
是否使用PYTHON API: 是, 目标是安装后CAFFE能作为PYTHON MODULE来使用
硬件: 云服务器, 只使用CPU模式
本文主要参考大牛的博客https://www.cnblogs.com/xuanxufeng/p/6016945.html 然后填了一些自己安装过程中遇到的坑。
1.安装依赖
1
sudo apt-get
install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-
compiler
2
sudo
apt-get
install
--no-
install
-recommends libboost-all-
dev
3
sudo
apt-get
install
libgflags-dev libgoogle-glog-dev liblmdb-
dev
4
sudo
apt-get
install
libatlas-base-dev
5 sudo apt-get
install
libopencv-dev
PYTHON需要2.7版本,这是操作系统本身已经安装好的. 输入python2.7 --version 会显示具体的版本号说明安装了.
但是还需要sudo apt-get install python-dev
2.下载Caffe 使用Git直接下载Caffe非常简单,或者去https://github.com/BVLC/caffe下载。由于我习惯去github上找代码,所以就直接去下载的源码。
使用git下载caffe到家目录,下载完成后,会在家目录下的下载里找到caffe文件夹,切换到caffe文件夹中。
$ cd ~
$ git clone git://github.com/BVLC/caffe.git
$ cd caffe
3.编译Caffe (1)创建Makefile.comfig文件
cp Makefile.config.example Makefile.config
(2)修改配置文件Makefile.config
- style="font-size:14px;"># CPU-only switch (uncomment to build without GPU support).
- CPU_ONLY := 1 #一定需要打开。
- # Uncomment if you're using OpenCV 3
- # OPENCV_VERSION := 3 #用的是2.4版本不需要打开。
- # 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++ #已经更新到至少4.8,选择默认的就好。
- # CUDA directory contains bin/ and lib/ directories that we need. #这是GPU用到的,注释掉就可以。