从tensorflow.examples.tutorials.mnist导入input_data出现错误并弹窗的解决方案

Tensorflow报错解决:

import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data  # 报错

我今天在使用tensorflow.examples.tutorials.mnist来加载 input_data时发生了错误,具体如下

---------------------------------------------------------------------------
NotFoundError                             Traceback (most recent call last)
<ipython-input-1-6309be30be49> in <module>()
      2 import sklearn.preprocessing as prep
      3 import tensorflow as tf
----> 4 from tensorflow.examples.tutorials.mnist import input_data

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\examples\tutorials\mnist\__init__.py in <module>()
     19 from __future__ import print_function
     20 
---> 21 from tensorflow.examples.tutorials.mnist import input_data
     22 from tensorflow.examples.tutorials.mnist import mnist

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\examples\tutorials\mnist\input_data.py in <module>()
     28 from six.moves import xrange  # pylint: disable=redefined-builtin
     29 import tensorflow as tf
---> 30 from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
     31 # pylint: enable=unused-import

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\contrib\__init__.py in <module>()
     34 from tensorflow.contrib import crf
     35 from tensorflow.contrib import cudnn_rnn
---> 36 from tensorflow.contrib import data
     37 from tensorflow.contrib import deprecated
     38 from tensorflow.contrib import distribute

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\contrib\data\__init__.py in <module>()
     69 from tensorflow.contrib.data.python.ops.counter import Counter
     70 from tensorflow.contrib.data.python.ops.enumerate_ops import enumerate_dataset
---> 71 from tensorflow.contrib.data.python.ops.error_ops import ignore_errors
     72 from tensorflow.contrib.data.python.ops.get_single_element import get_single_element
     73 from tensorflow.contrib.data.python.ops.grouping import bucket_by_sequence_length

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\contrib\data\python\ops\error_ops.py in <module>()
     18 from __future__ import print_function
     19 
---> 20 from tensorflow.contrib.data.python.ops import contrib_op_loader  # pylint: disable=unused-import
     21 from tensorflow.contrib.data.python.ops import gen_dataset_ops
     22 from tensorflow.python.data.ops import dataset_ops

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\contrib\data\python\ops\contrib_op_loader.py in <module>()
     22 
     23 _dataset_ops = loader.load_op_library(
---> 24     resource_loader.get_path_to_datafile("../../_dataset_ops.so"))

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\contrib\util\loader.py in load_op_library(path)
     54       return None
     55   path = resource_loader.get_path_to_datafile(path)
---> 56   ret = load_library.load_op_library(path)
     57   assert ret, 'Could not load %s' % path
     58   return ret

C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\python\framework\load_library.py in load_op_library(library_filename)
     54     RuntimeError: when unable to load the library or get the python wrappers.
     55   """
---> 56   lib_handle = py_tf.TF_LoadLibrary(library_filename)
     57 
     58   op_list_str = py_tf.TF_GetOpList(lib_handle)

NotFoundError: C:\Users\MSI\Anaconda3\lib\site-packages\tensorflow\contrib\data\python\ops\..\..\_dataset_ops.so not found

同时还出现了一个弹窗

解决方法:
沿着报错的路径一路走下去,找到_dataset_ops.so文件,然后将其移出data这个文件夹,随便自己创建一个新的文件夹保存_dataset_ops.so(万一以后还有用武之地呢。。)
做完这一步之后,你会惊奇地发现,错误消失了~

结束语:希望大家能够通过以上方法解决问题,附上一只可爱的狗狗.jpg


如果觉得我有地方讲的不好的或者有错误的欢迎给我留言,谢谢大家阅读(点个赞我可是会很开心的哦)~

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值