ModuleNotFoundError:没有名为"tensorflow.python.tools"的模块; 'tensorflow.python'不是一个包 [英] ModuleNotFoundError: No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package
问题描述
Tensorflow可以在jupyter笔记本电脑上正常工作,但是当我尝试
Tensorflow can exactly work at jupyter notebook, but when I try to
import tensorflow
在pycharm或只是在终端,我得到了
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可以在解释器中找到张量流: 软件包
pycharm can find tensorflow in interpreter: packages
tensorflow已安装,我可以在jupyter或ipython上使用它 在此处输入图片描述
tensorflow has been install, I can use it at jupyter or ipython enter image description here
推荐答案
即使在Github中存在解决方案,也要在此处添加解决方案,以使StackOverflow社区受益.
Adding the solution here, even though it is present in Github, for the benefit of the StackOverflow Community.
该错误是由于使用了Tensorflow中已使用的文件名所致.请将您的文件名更改为唯一.有关更多详细信息,请参见 github 线程
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
这篇关于ModuleNotFoundError:没有名为"tensorflow.python.tools"的模块; 'tensorflow.python'不是一个包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!