不能实例化boto3 S3Transfer类

2024-04-25 05:02:58 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试根据AWS文档设置三种传输方式:

import boto3
client = boto3.client('s3', 'us-east-1')
transfer = S3Transfer(client)

结果:

^{pr2}$

尝试了Python2.7.11和3.5.1(MacOS),结果相同。在my和O3中正确安装了Intellide:

Successfully installed boto3-1.2.3 botocore-1.3.26 docutils-0.12 futures-3.0.5 jmespath-0.9.0 python-dateutil-2.4.2

如有任何建议,我们将不胜感激。在

谢谢,罗恩


Tags: 文档importclientawss3mymacosboto3
1条回答
网友
1楼 · 发布于 2024-04-25 05:02:58

S3Transfer类在模块boto3.s3.transfer中,因此您必须执行以下操作:

from boto3.s3.transfer import S3Transfer
import boto3

client = boto3.client('s3')
transfer = S3Transfer(client)

注意上面的import语句。还要注意,S3Transfer方法已经集成到S3客户机和S3资源中,因此您可能不需要直接访问它。在

相关问题 更多 >