Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

python - ModuleNotFoundError: No module named 'keras' Can't import keras

I have tried reinstalling anaconda. I also tried uninstalling and reinstalling keras. I have tensorflow 2.3.0 and keras 2.4.3 installed. But I just can't seem to be able to import keras. This is my import statement.

from keras.models import Sequential
from keras.layers import Dense, LSTM
from pandas import DataFrame, concat
from sklearn.preprocessing import MinMaxScaler

And I get the error

ModuleNotFoundError: No module named 'keras'

I also tried installing them in different anaconda environments but it just doesn't seem to work. I am trying to make a deep learning model. Any help would be greatly appreciated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

With tensorflow 2.X keras is a part of tensorflow

maybe try:

from tensorflow import keras

and remove keras Its not so good too run keras and tensorflow in one enviroment


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...