tensorflow.keras无法引入layers

首先参考: 解决tensorflow.keras无法引入layers问题_ljx0951的博客-CSDN博客_tensorflow.keras.layers

print(tf.__path__)
print(keras.__path__)

这里报错: module 'keras.engine.base_layer' has no attribute 'BaseRandomLayer'

参考: python - module 'keras.engine' has no attribute 'Layer' - Stack Overflow 

使用

pip uninstall tensorflow -y
pip uninstall keras -y
pip install tensorflow==2.4.3
pip install keras==2.4.0

 解决

你可能感兴趣的:(AI,python,TensorFlow,Keras,导包)