2016-10-01 191 views
3

我首先启动了tensorflow,并且正在为初学者阅读教程。没有模块名为examples.tutorials.mnist

在窗口,所以我用的Oracle VM VirtualBox,我通过https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#virtualenv-installation

由PiP的virtualenv安装,我检查tensorflow通过编译“import tensorflow by tf”无差错运作良好。

但是,教程中,我在教程代码

没有名为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) 

回答

0

我有这个相同的问题,但我天真地在Windows上运行(Tensor Flow for Windows在2016年11月发布)。对我来说问题是我试图用错误版本的Python来运行它。

我使用pylauncer,除了Python 2.7(用于其他工作),还安装了Python v3.5 for Tensor流程。 Python 3.5需要在Windows上运行Tensor Flow。我的Python 2.7是我的默认设置,所以当我试图运行它时,我会得到错误,它运行时会导致错误版本的python。为了强制它使用Python 3,我运行了命令py -3 tf_tutorial.py而不是python tf_tutorial.py

不知道这是否会帮助你。但希望有人遇到这个问题认为这很有用。

相关问题