python - 无法在 Anaconda 上通过 Tensorflow 获取 MNIST 数据集

标签 python tensorflow machine-learning mnist

我正在尝试通过 Tensorflow 获取 MNIST 数据集,如下所示。

from tensorflow.examples.tutorials.mnist import input_data
data = input_data.read_data_sets("data/MNIST/", one_hot=True)

如标题所示,我在 Anaconda (Linux) 上安装了 Tensorflow,软件包版本为 tensorflow 1.8.0 (引用:https://anaconda.org/anaconda/tensorflow)

但以下是错误消息:

from tensorflow.examples.tutorials.mnist import input_data
ModuleNotFoundError: No module named 'tensorflow.examples'; 'tensorflow' is not a package

是否是因为tensorflow版本太旧而无法下载MNIST?

我还找到了相关问题:Cannot get MNIST database through Anaconda/jupyter 不过这是通过sklearn下载MNIST,Anaconda上可以通过tensorflow下载吗?

最佳答案

上述错误的两个可能原因:

  1. 您的文件名为 tensorflow.py,正如 xdurch0 所指出的
  2. 同一目录中还有另一个 python 文件,名为 tensorflow.py。如果存在,只需将其删除即可。

关于python - 无法在 Anaconda 上通过 Tensorflow 获取 MNIST 数据集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51340100/

相关文章:

python - 如何在python中转换 '22-Jul-2020 14:00 (GMT 4.30) ' "22 7 2020 "

python - 我应该为不存在的文件参数引发 ValueError 或 OSError 吗?

python - tensorflow mnist 示例精度没有增加

python - 使用 tensorflow 进行批量矩阵分解中的内存泄漏

python - Python-具有“可疑”时间的日志文件二进制搜索

tensorflow - 如何在 TensorFlow 中堆叠的 LSTM 单元之间添加 dropout 层?

python - 如何将 pandas.to_datetime 与 "strange"字符串格式一起使用

python - 数据在 scikit-learn 转换器中不持久

r - R 中多维尺度 (MDS) 的预测值

python - 找到值(value)并将其扩展到 pandas 中的分组