[Python] What is wrong with my Python and Tensorflow install?

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    I work on a PC with Windows 11 and have installed Python 3.11.9 which is supposed to be the required Python version for Tensorflow. I also installed numpy 1.26.4, scipy 1.15.2, Orange3 3.38.1 which were requested during earlier failures to install Tensorflow. The command 'pip install tensorflow' run successfully resulting in Tensorflow 2.19.0. In addition, I have installed the latest Microsoft Visual C++ Redistributable: Microsoft Visual C++ 2015-2019 Redistributable (x64) - 14.42.34438. Importing numpy and tensorflow results in the following error messages:

    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.
    --------------------------------------------------------


    Can anybody help me, please? I have no idea what to do next und need a running installation and import of tensorflow within the next hours! Help is highly appreciated!

    Continue reading...

Compartilhe esta Página