首页 > 解决方案 > 无法导入 tensorflow hub 我收到此错误

问题描述

import tensorflow_hub as hub

我得到错误

    Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import tensorflow_hub as hub
  File "E:\python64bit\lib\site-packages\tensorflow_hub\__init__.py", line 88, in <module>
    from tensorflow_hub.estimator import LatestModuleExporter
  File "E:\python64bit\lib\site-packages\tensorflow_hub\estimator.py", line 62, in <module>
    class LatestModuleExporter(tf.compat.v1.estimator.Exporter):
  File "E:\python64bit\lib\site-packages\tensorflow_core\python\util\module_wrapper.py", line 193, in __getattr__
    attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow._api.v1.compat.v1' has no attribute 'estimator'

标签: python-3.xtensorflow2.0tensorflow-hub

解决方案


推荐阅读