无法加载 tensorflow_hub

Gal*_*ams 7 python tensorflow tensorflow-hub

写入import tensorflow_hub后,出现如下错误:

class LatestModuleExporter(tf.estimator.Exporter):
Run Code Online (Sandbox Code Playgroud)

AttributeError: 模块 'tensorflow.python.estimator.estimator_lib' 没有属性 'Exporter'

我在 Windows 10 上使用 python 3.6 和 tensorflow 1.7

谢谢!

Cha*_*tor 11

你应该至少有 tensorflow 1.7.0,通过以下方式升级:

pip install "tensorflow>=1.7.0"
pip install tensorflow-hub
Run Code Online (Sandbox Code Playgroud)

进而:

pip install tensorflow-hub
Run Code Online (Sandbox Code Playgroud)

来源:这里


小智 0

我相信您的 python3 运行时并未真正与 TensorFlow 1.7 一起运行。该属性自 TensorFlow 1.4 起就存在。我怀疑 python2/3 环境之间存在一些不匹配,与 pip/pip3 安装不匹配,或者安装 tensorflow 和 tf-nightly pip 软件包时出现问题。

您可以通过以下方式仔细检查:

$ python3 -c "import tensorflow as tf; print(tf.__version__)"
Run Code Online (Sandbox Code Playgroud)