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
相关产品推荐
相关产品推荐

