导入tensorflow_hub 报错 AttributeError: module ‘tensorflow.tools.docs.doc_controls‘ has no attribute ‘in

当使用`import tensorflow_hub as hub`时,出现`AttributeError: module 'tensorflow.tools.docs.doc_controls' has no attribute 'inheritable_header'`的错误。这可能是由于TensorFlow和相关库版本不兼容导致的。解决方案包括安装`tensorflow-estimator`版本2.6.0或者将TensorFlow降级到2.5.1。经验证,安装2.6.0的`tensorflow-estimator`可以解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题

只要运行导入代码就报错

import tensorflow_hub as hub 

错误原因

AttributeError: module 'tensorflow.tools.docs.doc_controls' has no attribute 'inheritable_header'

版本

我的是
tensorflow:2.6版本
tensorflow_hub :0.12.0

解决办法

貌似有两种

1.安装 tensorflow-estimator==2.6.0

 pip install -U tensorflow-estimator==2.6.0

tensorflow-estimator版本一定要得是2.6.我安装了2.7(2021/12 最新2.7)的不行。重新安装2.6。安装2.6的然后就可以运行了。我就是这样子解决的

2. tensorflow 降级到2.5

 pip install -U tensorflow==2.5.1

有看到说可行。但是我没有尝试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值