Python 无法访问awscli中boto3的凭据-窗口7
我在my.aws(其主目录)中有Python 无法访问awscli中boto3的凭据-窗口7,python,python-3.x,amazon-web-services,amazon-s3,boto3,Python,Python 3.x,Amazon Web Services,Amazon S3,Boto3,我在my.aws(其主目录)中有凭证和配置,其中包含内容。运行代码时仍面临以下问题 translate = boto3.client(service_name='translate', region_name='us-east-1', use_ssl=True) 当做低于它的投掷错误 translate.translate_text() botocore.exceptions.NoCredentialsError:(“找不到凭据”,“发生在未命名的索引:0”处) 当硬编码时,它会工作 tra
凭证
和配置
,其中包含内容。运行代码时仍面临以下问题
translate = boto3.client(service_name='translate', region_name='us-east-1', use_ssl=True)
当做低于它的投掷错误
translate.translate_text()
botocore.exceptions.NoCredentialsError:(“找不到凭据”,“发生在未命名的索引:0”处)
当硬编码时,它会工作
translate = boto3.client(
service_name='translate',
aws_access_key_id='XXX',
aws_secret_access_key='XXXXX',
region_name='us-east-1',
use_ssl=True
)
在
mac上工作时
我没有遇到任何问题。只有在窗口中我卡住了。凭据应该在/home/.aws/
文件夹中。你的机器里有吗?是的,在那里。但是,当在boto3.client()中手动传递密钥和id时,它会起作用。您可以编辑问题以包含代码前后的几行吗?您是在Amazon EC2实例上运行代码,还是在您自己的计算机上运行代码?尝试使用boto3进行翻译。。