ModuleNotFoundError: No module named 'Tensorflow' in Python
I am running my python project on windows 10. I am having problems with importing TensorFlow
in my project. I installed tensorflow using pip3 but I got an error as below:
Traceback (most recent call last):
File "main.py", line 1, in <module>
import Tensorflow
ModuleNotFoundError: No module named 'Tensorflow'
I am using python 3.7.5 and TensorFlow 2.0.0.
I just installed TensorFlow with command:
pip3 install tensorflow==2.0.0
But it still solve issue for me!!
How can I fix it?
-
L0
Leonardo Urbano Aug 11 2021
For your project, please try to create a new virtual environment and then install all your required packages.
python3 -m venv env
and to activate it using the command:
source env/bin/activate
and then install the
tensorflow
package inside your virtual environment:pip3 install tensorflow
I hope it solve for you.
-
G-1
Gornpol Suksumrate Aug 11 2021
A better solution is to use a new Anaconda environment for your project. Once you’ve installed Anaconda, you can create a new environment and install TensorFlow:
conda create --name tensorflow-env python=3.8 pip conda activate tensorflow-env pip install tensorflow
Note: you can use a Python version other than 3.8, but as of this post the latest TensorFlow does not yet support 3.9.
If you need a version of TensorFlow before 2.0, you will need to install an earlier version of Python:
conda create --name tensorflow-env python=3.6 pip conda activate tensorflow-env pip install "tensorflow<2.0"
Hope it works for you.
-
D-3
Dhiraj Goplani Aug 11 2021
Try installing
tensorflow
again with whatever version you want and with option--ignore-installed
like:pip install tensorflow==2.0.0 --ignore-installed
I solved the same issue using this command.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.