小编Anu*_*h K的帖子

AttributeError:部分初始化的模块“tensorflow”没有属性“config”(很可能是由于循环导入)

我不断收到此错误:

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)
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
Run Code Online (Sandbox Code Playgroud)

这是我的 Tensorflow 版本:tensorboard-2.3.0tensorflow-2.3.1tensorflow-estimator-2.3.0tensorflow-gpu-2.3.1

我使用的是Python 3.8.0

python tensorflow

2
推荐指数
2
解决办法
1万
查看次数

标签 统计

python ×1

tensorflow ×1