centos安装caffe python接口时候可能出现错误

centos安装caffe python接口时候可能出现错误

1.安装pip

sudo yum install python-pip
sudo pip install requests[security]

2.安装scipy

# 出现找不到 lapack或blas
yum install lapack lapack-devel blas blas-devel

3.安装scikit-image

# 出现找不到freetype和png、jpeg
sudo yum -y install freetype-devel
sudo yum install libpng-devel
sudo yum install libjpeg-devel

4.安装过程中找不到其他依赖包(主要还是原来的pypip软件源下载的问题)
比如在这个:

distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('google-apputils')
可以通过下面命令手动安装
pip install google-apputils

5.执行make pycaffe的时候提示找不到numpy

python/caffe/_caffe.hpp:8:31: fatal error: numpy/arrayobject.h: No such file or directory

google了下:

Replicated for Fedora 20. Had the same problem, it appears to be that numpy was in the path /usr/lib64/python2.7/site-packages/numpy so you should change your Makefile.config’s Python include path to this. It happens when you install numpy through pip on a x64_86 computer. At least that’s the deal for Fedora.

这一般是因为numpy没有被caffe成功找到,通过观察发现通过pip安装numpy,是安装到usr/lib64下面,不是lib下面。
修改Make.config里面python路径
/usr/lib64/python2.7/site-packages/numpy

6.import caffe出错

(.:4962): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion ‘GDK_IS_DISPLAY (display)’ failed

这个错误一般是因为你在远程登陆服务器,而caffe python中 matplotlib是绘图功能,需要在图形界面才行,这时候可以在import之前加入如下代码解决:

import matplotlib 
matplotlib.use('Agg') 

你可能感兴趣的:(环境配置)