-----------------------------------------------------------------------------------
安装时遇到的坑:
1、yum install python-pip python-devel,当显示如下信息:
Installed:
python-devel.x86_64 0:2.7.5-58.el7
Dependency Updated:
python.x86_64 0:2.7.5-58.el7 python-libs.x86_64 0:2.7.5-58.el7
Complete!
表示成功。
2、执行pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl,提示:
。。。。。。
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)
说明走https时校验出了问题,将https改成http再执行,提示:“Successfully installed numpy-1.13.3 protobuf-3.0.0b2 six-1.11.0 tensorflow-0.9.0 wheel-0.30.0”,搞定
参考文章:https://www.cnblogs.com/chenjack/p/6322680.html
-----------------------------------------------------------------------------------------------------------------------------
运行时遇到的坑:
1、RuntimeError: module compiled against API version 9 but this version of numpy is 7
首先下载:wget http://jaist.dl.sourceforge.net/project/numpy/NumPy/1.11.0/numpy-1.11.0.zip
然后解压:unzip numpy-1.11.0.zip
之后安装:cd numpy-1.11.0;python setup.py install
2、运行时遇到的坑:RuntimeError: could not open display
解决办法:在源码中的import matplotlib as mpl前加两行代码,变为:
mpl.use('Agg')
import matplotlib.pyplot as plt
或者直接改文件:/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc,将backend 配置项改为Agg
不报错了,但是也不展示图像。
进一步解决:先装tkinter再卸载matplotlib后重装matplotlib
yum -y install tkinter
pip uninstall -y matplotlib
pip --no-cache-dir install -U matplotlib
改mpl.use(‘TkAgg’)或backend,提示:_tkinter.TclError: no display name and no $DISPLAY environment variable
后查明,通过secureCRT客户端登录是没法在centos上展现。
最终解决:
mpl.use改回到Agg,不再报错了。同时,在plt.show()的后面加上一句 plt.savefig('yourfilepath.png')执行完毕后,将png拷贝到自己windows机器上查看。
3、运行程序遇到的坑