python - ImportError:无法导入名称“GceClusterResolver”
问题描述
我正在按照安装 TensorFlow Slim 的指南进行操作,但遇到了这个错误。
ImportError: cannot import name 'GceClusterResolver'
我在网上搜了一下,在 Stack Overflow 上发现了一些关于“ import error cannot import name xxx ”的问题,但没有一个和我的一样。我也尝试过他们的解决方案,但没有奏效。
这是完整的错误信息。任何帮助是极大的赞赏。
python -c "import tensorflow.contrib.slim as slim; eval = slim.evaluation.evaluate_once"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 31, in <module>
from tensorflow.contrib import cluster_resolver
File "/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/cluster_resolver/__init__.py", line 26, in <module>
from tensorflow.python.distribute.cluster_resolver.gce_cluster_resolver import GceClusterResolver
ImportError: cannot import name 'GceClusterResolver'
解决方案
我发现我正在使用tflearn
withtensorflow 2
但 tflearn 与 tensorflow 2 不兼容。我刚刚退回到 tensorflow 1 版本。
# uninstall both libs
pip uninstall tensorflow
pip uninstall tflearn
# install the compatible version
pip install tflearn
pip install tensorflow==1.15
推荐阅读
- express - 数组自行填充
- php - Yii2:应用程序无法执行。Apache 显示“索引”
- javascript - 如何编写通过在一个链式惯用承诺中将文件写入云存储桶来响应数据变化的firebase云功能?
- php - Redis 会话 disable_locking 为 true
- unity3d - 如何正确使用 UNET
- ssas - 在 PowerBI 中合并来自多个 SSAS 多维数据集的数据
- wagtail - 如何迭代模板中的“页面”对象的属性?
- python - 图中的强连接组件 - networkx 库
- android - Android 应用在 onClickListener 上崩溃
- amazon-web-services - 当第一个实例达到 85% 的内存或 cpu 时,启动第二个实例 AWS,