I installed python but didn't work. Then all of the following but when, I was supposed to import the following it didn't work.
!pip install -U pip
!pip install tensorflow
from tensorflow import keras
from tensorflow.keras import layers
CodePudding user response:
I think you can try to run pip install tensorflow in command
CodePudding user response:
If you're having trouble importing a package in Python, it's possible that you haven't installed it properly or that it's not installed at all. To check if tensorflow is installed, you can try running pip freeze
in your terminal. This will print out a list of all the packages that are currently installed in your environment. If tensorflow is not in that list, then you need to install it.
If you're not sure how to install a package in Python, you can use the pip command. For example, to install tensorflow, you would run pip install tensorflow
in your terminal. Once the installation is complete, you should be able to import tensorflow in your Python code without any issues