没有名为“tensorflow.python.tools"的模块;'tensorflow.python' 不是一个包 [英] No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package

查看:90
本文介绍了没有名为“tensorflow.python.tools"的模块;'tensorflow.python' 不是一个包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一切都很顺利,直到我开始收到以下错误:

Everything was working smoothly until I started getting the following error:

回溯(最近一次调用最后一次):文件",第 1 行,在文件/home/user/Workspace/Practices/Tensorflow/tensorflow2/venv/lib/python3.7/site-packages/tensorflow/init.py",第98行,在从 tensorflow_core 导入 *文件/home/user/Workspace/Practices/Tensorflow/tensorflow2/venv/lib/python3.7/site-packages/tensorflow_core/init.py",第40行,在从 tensorflow.python.tools 导入 module_util 作为 _modle_utilModuleNotFoundError: 没有名为tensorflow.python.tools"的模块;'tensorflow.python' 不是一个包

Traceback (most recent call last): File "", line 1, in File "/home/user/Workspace/Practices/Tensorflow/tensorflow2/venv/lib/python3.7/site-packages/tensorflow/init.py", line 98, in from tensorflow_core import * File "/home/user/Workspace/Practices/Tensorflow/tensorflow2/venv/lib/python3.7/site-packages/tensorflow_core/init.py", line 40, in from tensorflow.python.tools import module_util as _modle_util ModuleNotFoundError: No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package

我的环境设置:

  • python-3.7
  • 使用 venv 模块创建虚拟环境张量流 2.0.0
  • pip 19.0.3
  • Manjaro Linux

现在,我什至无法导入 tensorflow 模块.它给出了相同的上述错误.尝试使用缓存和不使用缓存重新安装,但没有运气.也重新创建了虚拟环境,没有运气.这真的很奇怪,也不知道从哪里开始故障排除.查看虚拟环境站点包,一切似乎都很好.

Now, I even can't import tensorflow module as well. It gives same above error. Tried reinstalling with cache and without cache as well, but no luck. Recreated virtual environment as well, no luck. This is really weird and have no clue where to start troubleshooting as well. Looking at virtual environment site packages, everything seems fine.

推荐答案

我现在刚遇到这个问题.我在另一台计算机上运行源代码,它显示相同的错误.我继续比较了 TensorFlow 的版本,结果发现另一台计算机运行的是 tensorflow==2.1.0,而我的运行的是 tensorflow==1.14.0.

I just faced this problem right now. I ran the source code on another computer and it showed the same error. I went ahead and compared the version of TensorFlow and turns out that the other computer was running tensorflow==2.1.0 and mine was running tensorflow==1.14.0.

简而言之,降级你的tensorflow安装(pip install tensorflow==1.14.0)

In short, downgrade your tensorflow installation (pip install tensorflow==1.14.0)

这篇关于没有名为“tensorflow.python.tools"的模块;'tensorflow.python' 不是一个包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆