python - Tensorflow 导入错误 AttributeError:“模块”对象没有属性“导出器”
问题描述
当我尝试导入 tensorflow 集线器时,我收到以下错误消息,指出“模块”对象没有属性“导出器”。
AttributeErrorTraceback (most recent call last)
<ipython-input-1-31fb71834c8c> in <module>()
1 # Install TF-Hub.
2 import tensorflow as tf
----> 3 import tensorflow_hub as hub
4 import matplotlib.pyplot as plt
5 import numpy as np
/usr/local/lib/python2.7/dist-packages/tensorflow_hub/__init__.py in <module>()
24 import tensorflow as tf
25
---> 26 from tensorflow_hub.estimator import LatestModuleExporter
27 from tensorflow_hub.estimator import register_module_for_export
28 from tensorflow_hub.feature_column import image_embedding_column
/usr/local/lib/python2.7/dist-packages/tensorflow_hub/estimator.py in <module>()
59
60
---> 61 class LatestModuleExporter(tf.estimator.Exporter):
62 """Regularly exports registered modules into timestamped directories.
63
AttributeError: 'module' object has no attribute 'Exporter'
解决方案
这是由于旧版本的 tensorflow 造成的。它应该 >1.7
推荐阅读
- reactjs - 如何让多个 refs 使用相同的 handleClick 函数?
- c# - Web API OData V4 在本地工作,但不在 IIS 上
- angular - 如何在 Angular 中应用带有百分比的样式?
- javascript - 无法将路径附加到 svg
- jdbc - 如何将动态 SQL 语句传递给 apache 梁中的 JDBCIO 连接器?
- npm - EACCES:权限被拒绝——即使使用 sudo
- c - 如何避免必须从我的 makefile 中的不同路径手动列出每个 C 文件?
- windows - findstr 在块内返回错误的错误代码
- excel - 如何在excel函数中使用相对范围
- google-apps-script - 如何创建 Google 脚本循环以激活和复制工作簿中每个选项卡中的数据