Reputation: 1
When I try to run
import tensorflow as tf
at pycharm , then I got the error message
ModuleNotFoundError: No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package
I refer to questions like question 1 and question 2 , they are just to recommend downgrade or reinstalling.
The particularity of this problem is :
import tensorflow
in cmd ,it works well.I have checked the interpreter of pycharm and this project and it was correct .
How can I resolve it ? I have fight with this problems for 3 days.
Upvotes: 0
Views: 889
Reputation: 11
I had the same problem with you. I found it is the pycharm to be blamed. In tensorflow version later than 2.0.0, the main functions of tensorflow is located in tensorflow_core instead of the folder tensorflow like tensorflow 1.x. When you use cmd, python can find these packages(by some methods), but the pycharm of old version cannot. So update your pycharm or use earlier versions of tensorflow might solve your problem. Unable to import Keras(from TensorFlow 2.0) in PyCharm. these question said that PyCharm can recognises tensorflow 2.0.0b1)
Upvotes: 1