如何为python设置google云帐户?
我已经创建了一个谷歌云存储桶 现在我想通过python访问它 我已经在本地安装了如何为python设置google云帐户?,python,google-cloud-platform,Python,Google Cloud Platform,我已经创建了一个谷歌云存储桶 现在我想通过python访问它 我已经在本地安装了google云存储 pip安装谷歌云存储 我已经定义了所有凭证和bucket的名称。这就是我正在做的: from google.cloud import storage client = storage.Client() bucket_id = 'myBucket' bucket = client.get_bucket(bucket_id) 这就是我得到的 DefaultCredentialsError: Coul
google云存储
pip安装谷歌云存储
我已经定义了所有凭证和bucket的名称。这就是我正在做的:
from google.cloud import storage
client = storage.Client()
bucket_id = 'myBucket'
bucket = client.get_bucket(bucket_id)
这就是我得到的
DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
正如Scratch'N'Purr提到的
您需要将身份验证设置为
然后,脚本将使用给定的凭据访问GCP上的资源
问候,
Frederic您是否尝试按照错误消息所述执行操作?@MadPhysicast是的,但我没有找到该帐户的.json文件key@emax也许您忘记创建服务帐户并下载json文件:是的,对不起,刚刚意识到