【问题标题】:Unsable to import from tensorflow after install. Please help understand and remove the following error安装后无法从 tensorflow 导入。请帮助理解并删除以下错误
【发布时间】:2021-08-07 14:42:23
【问题描述】:
from tensorflow import keras

ImportError Traceback(最近调用 最后的) ~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py 在 63 尝试: ---> 64 来自 tensorflow.python._pywrap_tensorflow_internal 导入 * 65 # 这个 try catch 逻辑是因为 py_extension 没有 bazel 等价物。

ImportError: DLL load failed: 找不到指定的模块。

在处理上述异常的过程中,又发生了一个异常:

ImportError Traceback(最近调用 最后)在 ----> 1 来自张量流导入 keras

~\anaconda3\lib\site-packages\tensorflow_init_.py in 39 导入系统为_sys 40 ---> 41 从 tensorflow.python.tools 导入 module_util 作为 _module_util 42 从 tensorflow.python.util.lazy_loader 导入 LazyLoader 作为 _LazyLoader 43

~\anaconda3\lib\site-packages\tensorflow\python_init_.py 在 38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top 39 ---> 40 来自 tensorflow.python.eager 导入上下文 41 从 tensorflow.python 导入 pywrap_tensorflow 作为 _pywrap_tensorflow 42

~\anaconda3\lib\site-packages\tensorflow\python\eager\context.py 在 33 从 tensorflow.core.protobuf 导入 config_pb2 34 从 tensorflow.core.protobuf 导入 rewriter_config_pb2 ---> 35 从 tensorflow.python 导入 pywrap_tfe 36 从 tensorflow.python 导入 tf2 37 从 tensorflow.python.client 导入 pywrap_tf_session

~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py 在 26 27 # pylint: disable=invalid-import-order,g-bad-import-order, wildcard-import,未使用的导入 ---> 28 从 tensorflow.python 导入 pywrap_tensorflow 29 来自 tensorflow.python._pywrap_tfe 导入 *

~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py 在 81 的一些常见原因和解决方案。包括整个堆栈跟踪 82 上面这个错误信息请求帮助时。""" % traceback.format_exc() ---> 83 引发 ImportError(msg) 84 85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback(最近一次调用最后一次):文件 "C:\Users\Dell\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", 第 64 行,在 from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed: 找不到指定的模块。

无法加载原生 TensorFlow 运行时。

【问题讨论】:

标签: python python-3.x tensorflow keras


【解决方案1】:

在 jupyter notebook 中使用以下代码安装 tensorflow。

conda create -n tensorflow python=3.5

激活张量流

!pip 安装张量流。

【讨论】:

    猜你喜欢
    • 2021-08-17
    • 1970-01-01
    • 2022-06-14
    • 1970-01-01
    • 2021-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-15
    相关资源
    最近更新 更多