【问题标题】:Tensorflow 2.4 - DLL load failed while importing _pywrap_tensorflow_internalTensorflow 2.4 - 导入 _pywrap_tensorflow_internal 时 DLL 加载失败
【发布时间】:2021-04-28 00:31:25
【问题描述】:

我在带有 Python 3.8(我也安装了 Python 3.9 和 3.6)的 Windows 10 上使用 TensorFlow 2.4,在 ml2u 的虚拟环境中,pip install tensorflow 到目前为止只安装了 TensorFlow 2.4。通过尝试在笔记本中导入 TensorFlow,我收到以下错误消息。按照其他帖子中的建议,我安装了 Microsoft Visual C++ Redistributable,从而安装了 MS Visual 和 VC_redist.x64.exe

import tensorflow as tf

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
c:\users\lenovo\appdata\local\programs\python\python38\scripts\ml2u\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     63   try:
---> 64     from tensorflow.python._pywrap_tensorflow_internal import *
     65   # This try catch logic is because there is no bazel equivalent for py_extension.

ImportError: DLL load failed while importing _pywrap_tensorflow_internal: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-1-64156d691fe5> in <module>
----> 1 import tensorflow as tf

c:\users\lenovo\appdata\local\programs\python\python38\scripts\ml2u\lib\site-packages\tensorflow\__init__.py in <module>
     39 import sys as _sys
     40 
---> 41 from tensorflow.python.tools import module_util as _module_util
     42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
     43 

c:\users\lenovo\appdata\local\programs\python\python38\scripts\ml2u\lib\site-packages\tensorflow\python\__init__.py in <module>
     37 # go/tf-wildcard-import
     38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
---> 39 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
     40 
     41 from tensorflow.python.eager import context

c:\users\lenovo\appdata\local\programs\python\python38\scripts\ml2u\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     81 for some common reasons and solutions.  Include the entire stack trace
     82 above this error message when asking for help.""" % traceback.format_exc()
---> 83   raise ImportError(msg)
     84 
     85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "c:\users\lenovo\appdata\local\programs\python\python38\scripts\ml2u\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

----

The shell produced followint output while running jupyter:
[W 20:51:12.010 NotebookApp] Notebook Untitled.ipynb is not trusted
[I 20:51:14.060 NotebookApp] Kernel started: 0d0455bd-ade8-4128-b273-0b24e8d9228f, name: ml2u

【问题讨论】:

    标签: python c++ python-3.x tensorflow dll


    【解决方案1】:

    您可能会遇到此问题,因为您运行的是 32 位 python 或 32 位操作系统。并检查您的 CPU 是否支持 AVX 指令。

    请查看system requirements 并检查您是否安装了正确的依赖项。

    【讨论】:

      猜你喜欢
      • 2021-07-19
      • 2020-09-21
      • 2021-03-04
      • 2018-08-13
      • 2020-11-19
      • 2019-09-08
      • 1970-01-01
      • 2020-07-11
      • 1970-01-01
      相关资源
      最近更新 更多