python - ImportError:无法导入名称“迭代器”
问题描述
我想在 Google Colab 上运行分段代码(在 github 中有此链接:https ://github.com/taigw/brats17 ),我遇到了这个错误:
/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "test.py", line 18, in <module>
from tensorflow.contrib.data import Iterator
ImportError: cannot import name 'Iterator'
解决方案
尝试这个:
import tensorflow as tf
Iterator = tf.data.Iterator
推荐阅读
- java - 在同一类的特定实例之间共享数据
- ruby - 如何在黄瓜红宝石中暂停执行错误
- java - JavaFX - 屏蔽窗格会降低对 3D 对象的可见性
- drupal - Drupal 7 管理面板中的问题
- php - 经过几个月的完美工作后,Xdebug 停止了与客户的联系
- node.js - 在特定目录中抓取和保存链接。切里奥
- cassandra-3.0 - cassandra.yaml 更改根本不起作用
- javascript - 在函数后将对象存储在状态中
- sql - 如何解决跨两个不同年份的事务的 ISO_WEEK 分区问题
- xamarin.forms - Xamarin.Forms 是 Xamarin.Android、Xamarin.IoS 和 Xamarin.Win 的简单总和吗?