import tensorflow returns ModuleNotFoundError: No module named 'tensorflow.python'; 'tensorflow' is not a package

Viewed 1259

I am trying to import Tensorflow from within PyCharm. My Python version is 3.10 and tensorflow version is 2.8. What could be the cause of the error?

import tensorflow as tf

and returns

module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'tensorflow.python'; 'tensorflow' is not a packag

python version tensorflow versi

1 Answers

Please verify:

  1. make sure that both python and tensorflow are installed in the same path where you are trying to execute py folder/code.py [python and OS are 64 bit]

2.ensure you are not using file name as csv.py which already exist in python library. 2. pip uninstall tensorflow and then pip install tensorflow==2.7 stable version then run help('modules') you may refer to this

Similar issues: reference1 reference2

Related