TensorFlow MNIST 示例不是 运行 fully_connected_feed.py

TensorFlow MNIST example not running with fully_connected_feed.py

我能够 运行 Deep MNIST Example 很好,但是当 运行 宁 fully_connected_feed.py 时,我收到以下错误:

File "fully_connected_feed.py", line 19, in <module>
from tensorflow.g3doc.tutorials.mnist import input_data ImportError: No module named
g3doc.tutorials.mnist

我是 Python 的新手,所以也可能只是一般设置问题。

这是一个 Python 路径问题。假设目录 tensorflow/g3doc/tutorials/mnist 是您当前的工作目录(或在您的 Python 路径中),最简单的解决方法是将 fully_connected_feed.py 中的以下行从:

from tensorflow.g3doc.tutorials.mnist import input_data
from tensorflow.g3doc.tutorials.mnist import mnist

...至:

import input_data
import mnist

另一种选择是 link github 存储库中的 'g3doc' 目录进入 tensorflow python wheel 文件夹。这样你就不需要更改代码了。