简体   繁体   中英

ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' [start point : from keras.layers.core import Activation]

I am getting the following error :

Traceback (most recent call last):
    File "Estimate parameters with lstm.py", line 13, in <module>
         from keras.layers.core import Activation
    File "/home/zeus/my_env/lib/python3.8/site-packages/keras/__init__.py", line 25, in <module>
         from keras import models
    File "/home/zeus/my_env/lib/python3.8/site-packages/keras/models.py", line 19, in <module>
         from keras import backend
   File "/home/zeus/my_env/lib/python3.8/site-packages/keras/backend.py", line 36, in <module>
         from tensorflow.python.eager.context import get_config
   ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' 

There are many causes that this happens.

pip install --upgrade tensorflow
pip install --upgrade tensorflow-gpu

This is TensorFlow<\/code> and keras<\/code> version mismatch error.

import tensorflow
print(tf.__version__)
import keras
print(keras.__version__)

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