
答案1
TensorFlow 安装正确,但必须从 python3 解释器运行,而您尝试从 python 解释器运行它。
启动 python3 解释器python3
并运行以下代码行来导入 tensorflow。
import tensorflow as tf
如果import tensorflow as tf
没有返回错误消息,则表示已成功导入。现在您已经安装了 TensorFlow,您可能希望运行示例代码TensorFlow 2 初学者快速入门教程开始使用它。示例代码还需要 Keras 深度学习框架。
sudo apt 安装 python3-keras# 18.04 及更高版本