2016-10-01 180 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

不知道這是否會幫助你。但希望有人遇到這個問題認爲這很有用。