虚拟机ubuntu16.04 安装caffe
2017-04-26 13:35
267 查看
1.基本依赖
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compilersudo apt-get install
--no-install-recommends libboost-all-dev
2.安装blas(基础线性代数子程序库,里面拥有大量已经编写好的关于线性代数运算的程序)
sudo apt-get install libatlas-base-dev
3.安装python
sudo apt-get install
python-dev
4.在虚拟加上用的virtual box显卡驱动。没法用 GPU。CUDA是GPU模式使用的
5.ubuntu 16.04 不存在。14.04存在
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
6.下载 caffe源代码
git clone https://github.com/BVLC/caffe.git
b1b4
7.进入caff/python 安装python依赖包
for req in $(cat requirements.txt); do pip install $req; done
其实直接
pip install -r requirements.txt 也是 可以的
8.编译(make)
cp Makefile.config.example Makefile.config
#修改配置。如果需要GPU模式。则需要cuDNN
是否需要
因为CPU MODE, 所以在CPU_ONLY := 1前面的#要去掉.
加上hdf5路径 否则报路径不存在
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/hdf5/serial
编译caffe 的 python 操作库
make pycaffe
编译 MATLAB
#make matcaffe
要确保 python 和 matlab的路径都在Makefile.config 里面。这里不装MATLAB。只装python
make all
make testmake runtest
小插曲:
在虚拟机里安装碰到这样的问题:
ln: failed to create symbolic link 'build': Read-only file system
Makefile:562: recipe for target '.build_release/.linked' failed
make: *** [.build_release/.linked] Error 1
源代码在虚拟机 和 宿主机的共享文件夹里面 。不能建立符号链接。把源码移到其他位置就好了
下面的错误是需要在 INCLUDE_DIRS 加上
/usr/include/hdf5/serial
LIBRARY_DIRS 加上 /usr/lib/x86_64-linux-gnu/hdf5/serial
src/caffe/net.cpp:8:18: fatal error: hdf5.h: No such file or directory
compilation terminated.
Makefile:581: recipe for target '.build_release/src/caffe/net.o' failed
make: *** [.build_release/src/caffe/net.o] Error 1
如果报这样的错误:
python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
Makefile:507: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1
则是numpy没有安装到位:
apt-get install python-numpy
或者是 Makefile.config 中numpy的路径配置错误 。pip安装的numpy路径和使用 apt-get 安装的numpy路径是不一样的。pip一般是 :/usr/local/lib/python2.7/dist-packages
而linux安装的一般在:/usr/local/lib/python2.7/dist-packages
注:有显卡,gpu的安装参考
http://www.linuxdiyf.com/linux/24659.html
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compilersudo apt-get install
--no-install-recommends libboost-all-dev
2.安装blas(基础线性代数子程序库,里面拥有大量已经编写好的关于线性代数运算的程序)
sudo apt-get install libatlas-base-dev
3.安装python
sudo apt-get install
python-dev
4.在虚拟加上用的virtual box显卡驱动。没法用 GPU。CUDA是GPU模式使用的
5.ubuntu 16.04 不存在。14.04存在
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
6.下载 caffe源代码
git clone https://github.com/BVLC/caffe.git
b1b4
7.进入caff/python 安装python依赖包
for req in $(cat requirements.txt); do pip install $req; done
其实直接
pip install -r requirements.txt 也是 可以的
8.编译(make)
cp Makefile.config.example Makefile.config
#修改配置。如果需要GPU模式。则需要cuDNN
是否需要
因为CPU MODE, 所以在CPU_ONLY := 1前面的#要去掉.
加上hdf5路径 否则报路径不存在
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/hdf5/serial
编译caffe 的 python 操作库
make pycaffe
编译 MATLAB
#make matcaffe
要确保 python 和 matlab的路径都在Makefile.config 里面。这里不装MATLAB。只装python
make all
make testmake runtest
小插曲:
在虚拟机里安装碰到这样的问题:
ln: failed to create symbolic link 'build': Read-only file system
Makefile:562: recipe for target '.build_release/.linked' failed
make: *** [.build_release/.linked] Error 1
源代码在虚拟机 和 宿主机的共享文件夹里面 。不能建立符号链接。把源码移到其他位置就好了
下面的错误是需要在 INCLUDE_DIRS 加上
/usr/include/hdf5/serial
LIBRARY_DIRS 加上 /usr/lib/x86_64-linux-gnu/hdf5/serial
src/caffe/net.cpp:8:18: fatal error: hdf5.h: No such file or directory
compilation terminated.
Makefile:581: recipe for target '.build_release/src/caffe/net.o' failed
make: *** [.build_release/src/caffe/net.o] Error 1
如果报这样的错误:
python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
Makefile:507: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1
则是numpy没有安装到位:
apt-get install python-numpy
或者是 Makefile.config 中numpy的路径配置错误 。pip安装的numpy路径和使用 apt-get 安装的numpy路径是不一样的。pip一般是 :/usr/local/lib/python2.7/dist-packages
而linux安装的一般在:/usr/local/lib/python2.7/dist-packages
注:有显卡,gpu的安装参考
http://www.linuxdiyf.com/linux/24659.html
相关文章推荐
- 自己安装虚拟机vbox+ubuntu16.04+opencv3.2.0+python2.7+caffe+CPUonly的全过程整理
- VMware12虚拟机中Ubuntu16.04安装CPU版本Caffe
- Ubuntu16.04 安装caffe
- Ubuntu16.04安装配置GPU版本Caffe经验总结
- Ubuntu16.04+cuda8.0+opencv3.1+caffe+anaconda安装,双显卡
- ubuntu16.04和服务器 caffe 安装
- Ubuntu14+OpenCV3.1+Caffe虚拟机安装笔记(二)
- 在windows 虚拟机中安装ubuntu 16.04 LTS 系统的经验
- Ubuntu16.04安装caffe 框架
- 安装ubuntu 16.04虚拟机遇到busybox-initramfs 无法安装问题的解决
- Ubuntu16.04 Caffe安装
- ubuntu 16.04虚拟机 安装 openjdk 1.7
- Caffe Ubuntu16.04 GPU安装
- 进击的Geek(一):虚拟机环境下Ubuntu16.04的安装
- 虚拟机VMare12安装Ubuntu16.04
- Ubuntu16.04+CUDA8.0+cudnn7.5+Caffe安装过程
- Ubuntu 16.04+CUDA 9.1+cuDNN v7+OpenCV 3.4.0+Caffe+PyCharm 完全安装指南,国内最全!(适用CUDA 9.0)
- ubuntu 16.04 使用virt-manager 安装win7 虚拟机
- Ubuntu16.04+cuda8.0+caffe安装教程
- 双系统Ubuntu16.04的Caffe环境配置+opencv3.2.0安装