Python 没有名为examples.tutorials.mnist的模块
我首先开始学习tensorflow,当时我正在阅读初学者教程 在Windows中,所以我使用了Oracle VM VirtualBox,并通过pip virtualenv安装 并且,我通过编译“Python 没有名为examples.tutorials.mnist的模块,python,linux,tensorflow,Python,Linux,Tensorflow,我首先开始学习tensorflow,当时我正在阅读初学者教程 在Windows中,所以我使用了Oracle VM VirtualBox,并通过pip virtualenv安装 并且,我通过编译“importtensorflowbytf”检查了tensorflow是否工作正常,没有错误 但是,在教程中,我在教程代码中出现了错误 没有名为examples.tutorials.mnist的模块 在“from tensorflow.examples.tutorials.mnist import inpu
importtensorflowbytf
”检查了tensorflow是否工作正常,没有错误
但是,在教程中,我在教程代码中出现了错误
没有名为examples.tutorials.mnist的模块
在“from tensorflow.examples.tutorials.mnist import input_data
”处
我不明白为什么会有这样的错误。。。这不是下载MNIST数据的代码吗
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
import tensorflow as tf
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784,10])) # weight
b = tf.Variable(tf.zeros([10])) # bias
y = tf.nn.softmax(tf.matmul(x, W) + b)
我也遇到了同样的问题,但我在Windows上天真地运行它(Tensor Flow for Windows于2016年11月发布)。我的问题是,我试图使用错误的Python版本运行它 除了使用Python 2.7(用于其他工作)之外,我还安装了用于Tensor flow的Python v3.5。在windows上运行Tensor Flow需要Python 3.5。我将Python2.7作为默认版本,因此当我尝试运行它时,我会收到由于它使用错误版本的Python运行它而导致的错误。为了强制它使用Python3,我运行了命令
py-3tf\u tutorial.py
,而不是Python tf\u tutorial.py
不确定这是否对你有帮助。但希望有人发现这个问题有用