Tensorflow.io模块缺失-如何获取gfile?

Tensorflow.io模块缺失-如何获取gfile?,tensorflow,Tensorflow,我正在尝试使用tensorflow.io.gfile模块加载推理图。当我尝试导入gfile模块,以便能够访问gfile类时,我得到以下结果: >>> import tensorflow >>> from tensorflow.io import gfile Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError:

我正在尝试使用
tensorflow.io.gfile
模块加载推理图。当我尝试导入gfile模块,以便能够访问
gfile
类时,我得到以下结果:

>>> import tensorflow
>>> from tensorflow.io import gfile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow.io'

No module named 'tensorflow.io'
>>> tensorflow.__version__
'2.0.0'
导入tensorflow >>>从tensorflow.io导入gfile 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 ModuleNotFoundError:没有名为“tensorflow.io”的模块 没有名为“tensorflow.io”的模块 >>>tensorflow.\u版本__ '2.0.0' 我在MacOS Catalina上使用Python 3.7.4

如果缺少
tensorflow.io
,如何成功导入子模块

应该解决这个问题

答案取决于您正在使用TF2.0的假设,在该假设中,此功能已移动到单独的包中

pip install tensorflow.io