Ubuntu14.04+Caffe+python配置总结(CPU版)
来源:互联网 发布:淘宝屏蔽广告评论 编辑:程序博客网 时间:2024/05/29 15:36
1 安装所需要的依赖包
1.1 install protobuf, leveldb, snappy, opencv, hdf5, protobuf compiler and boost:
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
1.2 install dependencies, the commands below install gflags, glogs ,lmdb and atlas:
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev sudo apt-get install libatlas-base-dev
2 配置python
先执行命令:
sudo apt-get install 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
执行完命令后,可以检查一下,安装是否成功。输入python回车后,进入python shell模式,输入import numpy(其它包依此类推)检查numpy是否安装正常,不报错即可继续。
如果执行python代码时,出现“File "numpy/coretup.py", line 269, in check_types
"Cannot compile 'Python.h'. Perhaps you need to "
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.”
原因是找不到Python.h文件,需要安装numpy所需的依赖(包括python.h(在python-devel中)):apt-get build-dep python-numpy
3 安装Caffe
3.1 下载Caffe
Caffe下载地址:https://github.com/BVLC/caffe/,解压后,进入其根目录,Caffe给定了一个样例配置文件:Makefile.config.example,我们需要将复制为Makefile.config文件,通过命令:cp Makefile.config.example Makefile.config
因为我们只用CPU,因此需要将Makefile.config文件中“# CPU_ONLY := 1”,前面的#号去掉即可。
3.2 编译Caffe
进入caffe文件夹根目录下,eg:~/usr/caffe$ ,进行如下操作:
make all
make pycaffe
make distribute
时间稍微有点长。。。。。。
3.3 修改环境路径
在~/.bashrc中添加内容如下:
#caffe
export PYTHONPATH=$PYTHONPATH:/home/'username'/usr/caffe/python
输入source ~/.bashrc,使配置生效。
3.4 测试
Ceshi.py:
import syssys.path.append("/home/zk/usr/caffe/python")#python接口路径,如果以设置环境变量,就不需要这句了。import caffe
编译Ceshi.py通过,说明大功告成,可以开始DL之旅了。
- Ubuntu14.04+Caffe+python配置总结(CPU版)
- Ubuntu14.04+GTX1080+Caffe+python配置总结(GPU版)
- ubuntu14.04下CPU版caffe配置小结
- Ubuntu14.04下配置caffe(仅使用CPU)
- ubuntu14.04快速配置可用caffe环境(CPU)
- Ubuntu14.04+caffe+matlab(cpu)配置
- 【Caffe安装】Ubuntu14.04上Caffe配置安装(Only CPU)
- 在ubuntu14.04下搭建caffe-lstm(cpu版)
- Ubuntu14.04安装caffe(cpu版)
- Ubuntu14.04 安装Caffe(仅CPU)
- Ubuntu14.04 安装Caffe(仅CPU)
- Ubuntu14.04 安装Caffe(仅CPU)
- Ubuntu14.04 安装Caffe(仅CPU)
- ubuntu14.04配置caffe的python接口
- ubuntu14.04下安装caffe 仅cpu python接口
- ubuntu14+cpu caffe 安装
- ubuntu16.04配置caffe(CPU版)
- ubuntu16.04配置caffe(CPU版)
- 哈希查找
- PHP cURL
- JavaScript高级特性 — 作用域
- timer实现倒计时
- JavaScript原型与原型链分析
- Ubuntu14.04+Caffe+python配置总结(CPU版)
- 最详细的JavaScript和事件解读
- JavaScript 开发的45个经典技巧
- 二、Zedboard学习之SDK程序编写
- 杭电oj有关a+b的问题
- css妙用
- 机器学习-组合算法总结
- JavaScript中依赖注入详细解析
- webview加载assets下的html5页面