AttributeError: partially initialized module 'boto3' has no attribute 'resource' (most likely due to a circular import)

AttributeError: partially initialized module 'boto3' has no attribute 'resource' (most likely due to a circular import)

我正在使用 Pycharm 并安装了 boto3 包并尝试导入 boto3 并遇到属性错误。 Python.exe 文件路径在项目解释器中给出

import boto3

s3 = boto3.resource('s3')

AttributeError:部分初始化的模块 'boto3' 没有属性 'resource'(很可能是由于循环导入)

但相同的代码在 Python shell

中工作

我猜是因为你的文件名,当我尝试时,我在重命名文件名时遇到了同样的错误。我能够 运行 文件成功