运行tensorflow mnist tutorial遇到的问题及解决办法 - bettermorn/ACMWDevHubPPT GitHub Wiki

代码背景

https://github.com/GoogleCloudPlatform/tensorflow-without-a-phd/#featured-code-sample 包含tensorflow-mnist-tutorial

运行之前检查

确保安装最新tensorflow版本 以及tensorflow依赖库 参考此处 https://github.com/GoogleCloudPlatform/tensorflow-without-a-phd/blob/master/tensorflow-mnist-tutorial/INSTALL.txt

程序挂起,不运行

检查data目录下是否有数据文件 解决方法:可重试下载,或者拷贝数据至相应目录

在Pycharm中运行出现错误解决方法

错误:

Traceback (most recent call last): File "/Users/jane/ideaProjects/tensorflow-without-a-phd-master/tensorflow-mnist-tutorial/mnist_2.1_five_layers_relu_lrdecay.py", line 89, in datavis = tensorflowvisu.MnistDataVis() File "/Users/jane/ideaProjects/tensorflow-without-a-phd-master/tensorflow-mnist-tutorial/tensorflowvisu.py", line 192, in init legend.draggable(True) AttributeError: 'Legend' object has no attribute 'draggable'

'Legend' object has no attribute 'draggable'

原因:api并无此方法

修改方法:

查看API文档https://matplotlib.org/3.1.0/api/legend_api.html

修改代码:注:仅在Pycharm环境下修改tensorflowvisu.py, 在conda环境下不需修改

#legend.draggable(True) legend.set_draggable(True)

在Conda运行程序

python filename

⚠️ **GitHub.com Fallback** ⚠️