Last answered:

27 Dec 2022

Posted on:

29 Nov 2022

0

Resolved: ModuleNotFoundError: No module named 'tensorflow.keras'

I am using Tensorflow version 2.11.0 and python version 3.9.15.
Following is the code which I ran in Jupyter notebook.

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers

Output:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In [2], line 2
1 import tensorflow as tf
----> 2 from tensorflow import keras
3 from tensorflow.keras import layers
ImportError: cannot import name 'keras' from 'tensorflow' (unknown location)

2 answers ( 1 marked as helpful)
Posted on:

27 Dec 2022

0

Hello,

Please try and upgrading the tensorflow using the below command:

pip install tensorflow --upgrade



Thanks,
Siva

Posted on:

27 Dec 2022

0

Thanks.

Submit an answer