问题
Tensorflow can exactly work at jupyter notebook, but when I try to
import tensorflow
at pycharm or just in ternminal, I get
Traceback (most recent call last):
File "C:/Users/g-odi/Downloads/ipy/Deep-Learning-with-TensorFlow-book/ch03/main.py", line 5, in
<module>
import tensorflow as tf
File "C:\Users\g-odi\AppData\Local\conda\conda\envs\facat\lib\site-packages\tensorflow\__init__.py",
line 98, in <module>
from tensorflow_core import *
File "C:\Users\g-odi\AppData\Local\conda\conda\envs\facat\lib\site-
packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
ModuleNotFoundError: No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package
pycharm can find tensorflow in interpreter: packages
tensorflow has been install, I can use it at jupyter or ipython enter image description here
回答1:
Adding the solution here, even though it is present in Github, for the benefit of the StackOverflow Community.
The error is due to the usage of a file name that is already used in Tensorflow. Please change your file name to unique. For more details please refer github thread
来源:https://stackoverflow.com/questions/59006355/modulenotfounderror-no-module-named-tensorflow-python-tools-tensorflow-pyth