简体   繁体   中英

Keras requires TensorFlow 2.2 or higher,I have tensorflow 2.4

Here is my system info:

  • python == 3.7.9
  • keras == 2.2.0
  • Tensorflow 2.2.0

I also tried with

  • keras == 2.4.0
  • Tensorflow 2.4.0

and I also tried to install VC_redist.x64 But it doesn't always work

Any solutions?

Traceback (most recent call last):
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ tensorflow \ python \ pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ keras \ __ init__.py", line 3, in <module>
    from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ tensorflow \ __ init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ tensorflow \ python \ __ init__.py", line 39, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ tensorflow \ python \ pywrap_tensorflow.py", line 83, in <module>
    raise ImportError (msg)
ImportError: Traceback (most recent call last):
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ tensorflow \ python \ pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.


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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C: /Users/Mahdia/PycharmProjects/projet1/LP_Video8Dataframe.py", line 9, in <module>
    from keras.models import model_from_json
  File "C: \ Users \ Mahdia \ PycharmProjects \ project1 \ venv \ lib \ site-packages \ keras \ __ init__.py", line 6, in <module>
    'Keras requires TensorFlow 2.2 or higher. '
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`

I think the problem is in your PATH environment variable. The packages used in the IDE terminal are different from those used by your chosen IDE environment (and interpreter). Try to change the path in the PATH variable (don't forget the PATH system) to the same path used by your IDE environment. So you will use the same versions and same packages of the IDE environment (and therefore TensorFlow 2.4 instead of 2.2)

If you run from the IDE terminal don't forget to restart the IDE (or create a new session terminal) so that it loads the new paths of your environment variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM