No module named ‘tensorflow.keras.layers.embeddings‘报错

Problem Description:

I want to import the Embedding layer from keras and report an error,

Error:

Check the information on the Internet and say that tensorflow is added in front, and changed to the following: 

Another error:

So I checked it online again and saw a post that was inspired. The original post:  keras learning - No module named 'tensorflow.keras' reported an error, see tf.keras and keras_Eric_Blog_CSDN's blog-CSDN Blog

 Solution:

Check where the original directory embeddings is, and find that the directory is D:\PythonFile\Lib\site-packages\tensorflow_core\python\keras\layers, we see that there is an extra python in the middle, so add python after tensorflow, as follows

Successfully run!

Supongo que te gusta

Origin blog.csdn.net/Mason_Chen/article/details/120237939
Recomendado
Clasificación