本文介绍了导入错误:没有名为“tensorflow.contrib.data"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 tensorflow 版本是 1.1.0
我尝试导入一些文件:
strong textfrom tensorflow.contrib.data 导入数据集、迭代器
并得到错误:
导入错误:没有名为tensorflow.contrib.data"的模块
那么,这是什么解决方案?

My tensorflow version is 1.1.0
I try to import some file:
strong textfrom tensorflow.contrib.data import Dataset, Iterator
and got error :
ImportError: No module named 'tensorflow.contrib.data'
So, what is solution of this?

推荐答案

tf.contrib.data 已被弃用并被移除(检查 此处).因此,为了导入Dataset"和iterator",请按照以下步骤操作:

tf.contrib.data has been deprecated and been removed (Check here). So, in order to import "Dataset" and "iterator", follow the following steps:

  1. 您需要使用以下方法升级 tensorflow 版本:sudo pip3 install --upgrade tensorflow.在此处
  2. 查看安装指南
  3. 打开python终端并输入

  1. You need to upgrade the tensorflow version using:sudo pip3 install --upgrade tensorflow.Check the installation guide here
  2. Open the python terminal and type

将tensorflow导入为tf

dataset = tf.data.Dataset

希望它会有所帮助.

这篇关于导入错误:没有名为“tensorflow.contrib.data"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:11
查看更多