使用TensorFlow Mnist时出现错误

3
我刚开始使用Tensorflow,已经用我的test.py文件完成了“hello world”。接下来,我开始做教程(https://www.tensorflow.org/versions/master/tutorials/mnist/beginners/index.html)。这是我所做的:

$ git clone https://github.com/tensorflow/tensorflow

并运行“fully_connected_feed.py”文件:

python tensorflow/examples/tutorials/mnist/fully_connected_feed.py

我收到了以下错误信息:

Traceback (most recent call last):

File "tensorflow/examples/tutorials/mnist/fully_connected_feed.py",

line 27, in

from tensorflow.examples.tutorials.mnist import input_data

ImportError: No module named examples.tutorials.mnist

因此,我更改了代码:

从tensorflow.examples.tutorials.mnist导入input_data

从tensorflow.examples.tutorials.mnist导入mnist

导入input_data

导入mnist

但我又遇到了错误。

Traceback (most recent call last):

File "tensorflow/examples/tutorials/mnist/fully_connected_feed.py", line 27, in

import input_data File

"/Users/naggi/Documents/ML/tensorflow/tensorflow/examples/tutorials/mnist/input_data.py", line 29, in

from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets

ImportError: No module named contrib.learn.python.learn.datasets.mnist

有人可以帮我吗? 谢谢

2个回答

0

0

通过 pip 安装:

$ sudo apt-get install python-pip python-dev

$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

@NaggiGoishi 哪个Linux?Ubuntu? - Sung Kim
@NaggiGoishi “.whl不是受支持的wheel” 我认为你可以在Mac上使用whl文件。确保你使用正确的Mac版本。 - Sung Kim
@NaggiGoishi # 仅限于 Mac OS X,CPU: $ sudo easy_install --upgrade six $ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl - Sung Kim
@NishantSingh: @SungKim 谢谢!我已经下载了TensorFlow,我准备重新做Mnist! - Naggi Goishi
仍然出现错误:ImportError: 找不到模块 contrib.learn.python.learn.datasets.mnist - Matiss
显示剩余5条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接