AttributeError: module ‘tensorflow_core.compat.v2‘ has no attribute ‘__internal__‘
这个错误是什么导致的?因为找不到默认backend么?
这个错误是由于Keras在TensorFlow 2.0之后的版本中不再支持内部API。这个问题可以通过使用默认的TensorFlow后端来解决。可以在代码中添加以下行来设置后端:
import tensorflow as tf
tf.keras.backend.set_floatx('float32')
然后再尝试导入Keras。