ModuleNotFoundError:tensorflow 2.1.0 没有名为“tensorflow_core.estimator"的模块 [英] ModuleNotFoundError: No module named 'tensorflow_core.estimator' for tensorflow 2.1.0

查看:37
本文介绍了ModuleNotFoundError:tensorflow 2.1.0 没有名为“tensorflow_core.estimator"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When using tensorflow, I have the following error messages

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相关包如下图.我需要更新估算器的版本吗?如果是这种情况,如何安装正确版本的估算器?

The installed tensorflow related packages are shown as following. Do I need to update the estimator's version? If that's the case, how to install the estimator with right version?

推荐答案

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

TL;DR: Just solved this issue by making sure that both tensorflow and tensorflow-estimator were in the same version. (in my case, I needed to downgrade tensorflow-estimator, so conda install tensorflow-estimator=2.1.0 solved it for me)

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

As you may have noticed, some tensorflow versions do not play well with certain GPUs, so I would first check some of the available builds with conda search tensorflow; then I would make sure that the chosen tensorflow build can actually recognize my GPU (with tf.config.list_physical_devices('GPU')); finally, I would search for a matching tensorflow-estimator build with conda search tensorflow-estimator and only then install it with conda install tensorflow-estimator=<chosen version> -n <my_venv>.

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

It should be noted, however, that all these steps are mostly useful if you have interest in using your GPU. If that is not the case, than upgrading both packages (or downgrading/upgrading them so their versions match) may be the way.

这篇关于ModuleNotFoundError:tensorflow 2.1.0 没有名为“tensorflow_core.estimator"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆