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

核能气质少年 提交于 2020-05-26 05:37:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!