【发布时间】:2022-06-26 21:31:12
【问题描述】:
从 tensorflow.python 导入 tf2 ImportError:无法从“tensorflow.python”(未知位置)导入名称“tf2”
【问题讨论】:
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: python tensorflow importerror
从 tensorflow.python 导入 tf2 ImportError:无法从“tensorflow.python”(未知位置)导入名称“tf2”
【问题讨论】:
标签: python tensorflow importerror
你不需要指定tf2,如果你想使用TensorFlow 2你可以简单地安装
pip install tensorflow
安装最新版本的 tensorflow。然后在python代码中使用它,你可以简单地写
import tensorflow
【讨论】:
没错,但是:官方 TensorFlow 支持不鼓励使用 tf.python.*,因为它是私有的并且仅用于开发目的。虽然它在某些情况下可能有效,但在许多其他情况下会“突然中断”,通常导致“未找到模块”
【讨论】: