運行有關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_前不可以有任何跟程序有關的文字,否則就會報錯。