You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac M1设备Jupyter Notebook中tensorflow_hub导入循环依赖报错求助

解决方案
  • 卸载当前安装的高版本tensorflow_hub:
pip uninstall -y tensorflow_hub
  • 安装适配TensorFlow 2.6.0的tensorflow_hub 0.11.0版本:
pip install tensorflow_hub==0.11.0
  • 若操作后仍出现Another metric with the same name already exists报错,重新安装严格匹配版本的tensorflow-estimator:
pip uninstall -y tensorflow-estimator
pip install tensorflow-estimator==2.6.0
  • 验证修复效果:分别在终端和Jupyter Notebook中执行以下代码,无报错即为修复完成:
import tensorflow_hub as hub

报错根因为依赖版本不兼容:tensorflow_hub 0.12.0最低要求TensorFlow 2.7及以上版本,和你当前使用的TensorFlow 2.6.0存在冲突,会触发循环导入、指标重复注册两类报错。上述降级操作不需要改动你当前可用的tensorflow-macos版本,不会影响原有TensorFlow功能的正常使用。

内容的提问来源于stack exchange,提问作者Xi Liu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 02:54:07