No module named 'input_data'问题解决

运行有关mnist数据集文件时出现了No module named 'input_data'的问题,这个问题主要是因为你的py文件中缺少input_data.py的文件,只要在你建的文件夹中加入一个input_data.py文件即可。文件代码如下:



from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


import gzip
import os
import tempfile


import numpy
from six.moves import urllib
from six.moves import xrange  # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets

from __future__ imports must occur at the beginning of the file问题的解决

在运行input_data.py 文件是,出现了这个错误from __future__ imports must occur at the beginning of the file只要把开通的##中介绍的文字删掉即可,_future_前不可以有任何跟程序有关的文字,否则就会报错。

原文地址:https://www.cnblogs.com/Fiona-Y/p/13728707.html