CentOS服务器搭建Caffe(不完整版本)
程序员文章站
2022-05-31 19:59:46
...
0、先将物理机联网,提前搭建好nvidia驱动、CUDA、CUDNN
1、安装epel-release,否则有些Caffe的依赖包会找不到
yum install epel-release
2、安装Caffe依赖
yum install readline-devel protobuf-devel leveldb-devel snappy-devel opencv-devel opencv-python boost-devel hdf5-devel gflags-devel glog-devel lmdb-devel openblas-devel python-devel python-pip
3、拷贝Caffe-master,编译
4、搭建pycaffe
安装两个依赖,scikit-image和protobuf
(1)安装scikit-image==0.11.3
pip install matplotlib==2.2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install pillow==5.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install scipy==0.12.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install networkx==2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install scikit-image==0.11.3 -i https://pypi.tuna.tsinghua.edu.cn/simple/
(2)安装protobuf
pip install protobuf==3.6.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/
(3)编译pycaffe
进入caffe-master目录
cd /root/caffe-master
make pycaffe
(4)添加PYTHONPATH环境变量
vim /etc/profile
在末尾添加如下内容,若路径不一致,请根据实际情况修改。
export PYTHONPATH=/root/caffe-master/python:$PYTHONPATH
修改好配置文件后执行
source /root/profile
(5)验证pycaffe是否可用
在终端输入“python”进入Python交互界面import caffe测试是否成功。