以下安装步骤针对将所有依赖软件和caffe都安装在自己的 linux 账户下, 除了cuda/6.5
首先安装 boost,
Boost
1. download boost.tar.gz (google boost library)
2. tar -zxvf boost.tar.gz
3. cd boost
4. ./bootstrap.sh
5. mkdir build
6. ./b2 install --prefix=/your/path/boost/build/
然后在 ~/.bashrc 中加入
boost (self-built)
export PATH=/your/path/boost/:$PATH
export LD_LIBRARY_PATH=/your/path/boost_1_55_0/build/lib/:$LD_LIBRARY_PATH
export LIBRARY_PATH=/your/path/boost_1_55_0/build/lib/:$LIBRARY_PATH
export C_INCLUDE_PATH=/your/path/libs/boost_1_55_0/build/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/your/path/boost_1_55_0/build/include/:$CPLUS_INCLUDE_PATH
Path links /bin dir, LD_LIBRARY_PATH, LIBRARY_PATH link /lib dir, C_INCLUDE_PATH and CPLUS_INCLUDE_PATH link /include dir
Cmake
解压好,然后在 ~/.bashrc 里link path就好
#cmake
export PATH=/your/path/cmake_3_1_3/bin:$PATH
gflags
1. download and tar -zxvf
2. cd gflags
3. mkdir build & cd build
4. cmake .. -DCMAKE_INSTALL_PREFIX=/your/path/gflags/build
5. make
6. make install
然后在 ~/.bashrc 中加入
#gflags
export PATH=/your/path/gflags-2.1.1/build/bin:$PATH
export LD_LIBRARY_PATH=/your/path/gflags-2.1.1/build/lib/:$LD_LIBRARY_PATH
export LIBRARY_PATH=/your/path/gflags-2.1.1/build/lib/:$LIBRARY_PATH
export C_INCLUDE_PATH=/your/path/gflags-2.1.1/build/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/your/path/gflags-2.1.1/build/include/:$CPLUS_INCLUDE_PATH
在编caffe时,发现它会报错,说需要用 -fPIC 的命令
所以在 gflags 里的CMakelist.txt里加
set(CMAKE_CXX_FLAGS “-fPIC”)
Protobuf-2.6.1
1. download and tar -zxvf
3. mkdir build
5. ./configure --prefix=/your/path/gflags/build
6. make
7. make check
8. make install
然后在 ~/.bashrc 中加入
#protobuf
export PATH=/your/path/protobuf-2.6.1/build/bin:$PATH
export LD_LIBRARY_PATH=/your/path/protobuf-2.6.1/build/lib/:$LD_LIBRARY_PATH
export LIBRARY_PATH=/your/path/protobuf-2.6.1/build/lib/:$LIBRARY_PATH
export C_INCLUDE_PATH=/your/path/protobuf-2.6.1/build/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/your/path/protobuf-2.6.1/build/include/:$CPLUS_INCLUDE_PATH
glog_0.3.3
snapply
the same as protobuf
pip
[1] cd ${HOME}
[2] mkdir pip
[3] cd pip/
[4] wget https://bootstrap.pypa.io/get-pip.py
[5] python get-pip.py --user
.bashrc
export PATH=/home/ywchao/.local/bin:$PATH
Install python libraries
[1] pip install --user six
[2] pip install --user scikit-image
[3] pip install --user scipy
[4] pip install --user protobuf
[5] pip install --user pyyaml
lmdb
1. download from https://gitorious.org/mdb/mdb/source/3368d1f5e243225cba4d730fba19ff600798ebe3:libraries/liblmdb
2. cd liblmdb
3. make
.bashrc
export PATH=/your/path/prerequisites/liblmdb:$PATH
export LD_LIBRARY_PATH=/your/path/prerequisites/liblmdb:$LD_LIBRARY_PATH
export LIBRARY_PATH=/your/path/prerequisites/liblmdb:$LIBRARY_PATH
export C_INCLUDE_PATH=/your/path/prerequisites/libmdb:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/your/path/prerequisites/liblmdb:$CPLUS_INCLUDE_PATH
hdf5
1. download from http://www.hdfgroup.org/HDF5/release/obtainsrc.html#conf
2. cd hdf5
3. ./configure --prefix=/home/your/path
4. make all
5. make check
6. make install
.bashrc
export PATH=/your/path/prerequisites/hdf5-1.8.14/bin:$PATH
export LD_LIBRARY_PATH=/your/path/prerequisites/hdf5-1.8.14/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/your/path/prerequisites/hdf5-1.8.14/lib:$LIBRARY_PATH
export C_INCLUDE_PATH=/your/path/prerequisites/hdf5_1.8.14/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/your/path/prerequisites/hdf5-1.8.14/include:$CPLUS_INCLUDE_PATH
leveldb
1. download
2. cd leveldb
4. make all
5. make check
6. make install
.bashrc
#leveldb
export PATH=/your/path/prerequisites/leveldb-1.15.0:$PATH
export LD_LIBRARY_PATH=/your/path/prerequisites/leveldb-1.15.0:$LD_LIBRARY_PATH
export LIBRARY_PATH=/your/path/prerequisites/leveldb-1.15.0:$LIBRARY_PATH
export C_INCLUDE_PATH=/your/path/prerequisites/hdf5_1.8.14/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/your/path/prerequisites/leveldb-1.15.0/include:$CPLUS_INCLUDE_PATH
MKL
在 https://software.intel.com/en-us/intel-education-offerings 注册student账号,然后点击收到邮件的链接即可
进去后直接按步骤安装就好,其中需选择不覆盖原文件
mkl 在
opencv ###
download opencv-2.4.10
1. mkdir build
2. cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/your/path/prerequisites/opencv-2.4.10/build/ -DBUILD_PYTHON_SUPPORT=ON
3. make
4. make all
目前会报错
make matcaffe 报错
在 make matcaffe 的时候,会出现 boost 报错
解决的办法是:
在 Makefile.config 里的 LIBRARY_DIRS 里加入 boost 的 lib, 这样在 Makefile 里也会出现 boost
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /your/path/prerequisites/boost_1_55_0/build/lib