【发布时间】:2021-10-25 04:06:59
【问题描述】:
我不断收到此错误:
Traceback (most recent call last)
File "tensorflow.py", line 1, in <module>
import tensorflow as tf
File "C:\Users\Anush\Desktop\tensorflow.py", line 2, in <module>
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
AttributeError: partially initialized module 'tensorflow' has no attribute 'config' (most likely due to a circular import)
这是我的代码:
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
这是我的 Tensorflow 版本: tensorboard-2.3.0 tensorflow-2.3.1 tensorflow-estimator-2.3.0 tensorflow-gpu-2.3.1
我在 Python 3.8.0
【问题讨论】:
-
您的脚本是否命名为“tensorflow.py”?当您
import tensorflow时,您正在导入自己的文件。重命名你的脚本。
标签: python tensorflow