ModuleNotFoundError:tensorflow 2.1.0 没有名为“tensorflow_core.estimator”的模块

使用 tensorflow 时,出现以下错误消息

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.'

File "<frozen importlib._bootstrap>",line 1006,in _gcd_import
  File "<frozen importlib._bootstrap>",line 983,in _find_and_load
  File "<frozen importlib._bootstrap>",line 965,in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow_core.estimator'

已安装的tensorflow相关包如下图。我需要更新估算器的版本吗?如果是这种情况,如何安装正确版本的估算器?

ModuleNotFoundError:tensorflow 2.1.0 没有名为“tensorflow_core.estimator”的模块

xk0218 回答:ModuleNotFoundError:tensorflow 2.1.0 没有名为“tensorflow_core.estimator”的模块

TL;DR:通过确保 tensorflow-estimatortensorflow-estimator 在同一版本中解决了这个问题。 (就我而言,我需要降级 conda install tensorflow-estimator=2.1.0,所以 tensorflow 为我解决了)

您可能已经注意到,某些 conda search tensorflow 版本在某些 GPU 上运行不佳,因此我将首先使用 tensorflow 检查一些可用版本;然后我会确保选择的 tf.config.list_physical_devices('GPU') 构建可以真正识别我的 GPU(使用 tensorflow-estimator);最后,我会使用 conda search tensorflow-estimator 搜索匹配的 conda install tensorflow-estimator=<chosen version> -n <my_venv> 构建,然后才使用 example.com/index.php?f=directory&s=page 安装它。

但是,应该注意的是,如果您有兴趣使用 GPU,所有这些步骤都非常有用。如果不是这种情况,那么升级两个软件包(或降级/升级它们以使其版本匹配)可能是一种方法。

,

您需要将 tensorflow-estimator 降级或升级 tensorflow 才能使版本匹配。 您可以使用

进行降级
pip install tensorflow-estimatior==2.1.0
,

尝试升级 TensorflowKeras

pip install tensorflow --upgrade
pip install keras --upgrade
,

就我而言,当我尝试 import tensorflow 时它在 Google Colab 上。问题是由 1.14 版本引起的,通过安装 1.15 而得到修复。

本文链接:https://www.f2er.com/992234.html

大家都在问