暂无说说

caffe安装

工具 jiajun 3个月前 (11-17) 99次浏览 0个评论 扫描二维码

环境

[root@s100 ~]#  cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@s100 ~]# python
Python 2.7.5 (default, Aug  7 2019, 00:51:29) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

安装依赖

yum install -y epel-release
yum install -y git
yum -y install -y gcc+ gcc-c++
yum install -y protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel
yum install -y gflags-devel glog-devel lmdb-devel
yum install -y atlas-devel
yum install -y openblas-devel
yum install -y python-devel python-pip

安装 caffe

git clone https://github.com/bvlc/caffe.git
cd caffe
cp Makefile.config.example Makefile.config

修改配置 

vi Makefile.config
CPU_ONLY := 1   #去掉前面注释#,打开 CPU,表示 caffe 编译时仅支持 CPU,不支持 GPU
BLAS := open #由 BLAS := atlas 改为 BLAS := open

编译安装

make all
make test
make runtest

编译 pycaffe

安装依赖

python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
cd /opt/caffe/python/
vi requirements.txt
	    python-dateutil #python-dateutil>=1.4,<2 去掉后面版本号>=1.4,<2
pip install -r requirements.txt

修改配置

vi Makefile.config
修改下面内容
PYTHON_INCLUDE := /usr/include/python2.7 \
          /usr/lib64/python2.7/site-packages/numpy/core/include

编译

make clean
make all
make test
make runtest
make pycaffe

配置环境变量

vi /etc/profile
export PYTHONPATH=/opt/caffe/python:$PYTHONPAT
source /etc/profile

测试

[root@s100 caffe-master]# python
Python 2.7.5 (default, Aug  7 2019, 00:51:29) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>> 

 

喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址