Python3.11.9与TensorFlow2.19.0导入失败(DLL加载错误)求助
Python3.11.9与TensorFlow2.19.0导入失败(DLL加载错误)求助
我目前使用Windows 11系统,安装了TensorFlow要求的Python 3.11.9版本。之前安装TensorFlow失败时,我还额外安装了numpy 1.26.4、scipy 1.15.2和Orange3 3.38.1。后来执行pip install tensorflow成功安装了TensorFlow 2.19.0,同时我也安装了最新的Microsoft Visual C++ Redistributable(Microsoft Visual C++ 2015-2019 Redistributable (x64) - 14.42.34438)。
但导入numpy和tensorflow时出现了以下错误:
import numpy as np import tensorflow as tf --------------------------------------------------------------------------- ImportError Traceback (most recent call last) File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py:73 72 try: ---> 73 from tensorflow.python._pywrap_tensorflow_internal import * 74 # This try catch logic is because there is no bazel equivalent for py_extension. 75 # Externally in opensource we must enable exceptions to load the shared object 76 # by exposing the PyInit symbols with pybind. This error will only be 77 # caught internally or if someone changes the name of the target _pywrap_tensorflow_internal. 78 79 # This logic is used in other internal projects using 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) Cell In[8], line 1 ----> 1 import tensorflow as tf File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\__init__.py:40 37 _os.environ.setdefault("ENABLE_RUNTIME_UPTIME_TELEMETRY", "1") 39 # Do not remove this line; See https://github.com/tensorflow/tensorflow/issues/42596 ---> 40 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow # pylint: disable=unused-import 41 from tensorflow.python.tools import module_util as _module_util 42 from tensorflow.python.util.lazy_loader import KerasLazyLoader as _KerasLazyLoader File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py:88 86 sys.setdlopenflags(_default_dlopen_flags) 87 except ImportError: ---> 88 raise ImportError( 89 f'{traceback.format_exc()}' 90 f'\n\nFailed to load the native TensorFlow runtime.\n' 91 f'See https://www.tensorflow.org/install/errors ' 92 f'for some common causes and solutions.\n' 93 f'If you need help, create an issue ' 94 f'at https://github.com/tensorflow/tensorflow/issues ' 95 f'and include the entire stack trace above this error message.') 97 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long ImportError: Traceback (most recent call last): File "C:\Users\rolan\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, 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 causes and solutions. If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.
有没有人能帮帮我?我完全不知道接下来该怎么做,而且我需要在几小时内让TensorFlow能够正常安装和导入!非常感谢任何帮助!
备注:内容来源于stack exchange,提问作者Roland Alexander




