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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM