python - How to solve ModuleNotFoundError: No module named 'tensorflow.python.eager'
问题描述
Hi I'm using TensorFlow on Linux with python 3.8.5, and I have upgraded the TensorFlow. But when I run the following code in the TensorFlow virtual environment
import tensorflow as tf
from tensorflow import keras
def get_dataset(training=True):
mnist = keras.datasets.mnist
#some code
return something
It shows that
File "intro_keras.py", line 1, in <module>
import tensorflow as tf
File "/TensorFlow/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/TensorFlow/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 40, in <module>
from tensorflow.python.eager import context
ModuleNotFoundError: No module named 'tensorflow.python.eager'
How can I get rid of it? Thanks!
解决方案
推荐阅读
- rounding - IEEE 754 中算术运算的“默认舍入模式”的术语是什么?
- laravel - 无法安装 laravel/socialite 包
- angular - 角度 - 在搜索中粘贴 ng 选择不起作用
- python - Python Plotly Sankey Diagram:如何根据“源”和“目标”计算“值”,因此所有行与节点的高度相同
- google-cloud-platform - 是否有列出所有谷歌计算区域的 API
- sql - Web App查询慢,命令行查询快
- html - 响应元素上的背景图像和径向渐变?
- java - 为什么它显示只有创建视图层次结构的原始线程才能触摸它的视图
- laravel - pwa Laravel 在控制台中没有给我错误,但在缓存中的服务工作者中没有错误
- php - php ajax依赖下拉列表不从表中加载数据