小编Mar*_*eis的帖子

google.cloud导入存储:无法导入存储空间

我尝试按照我在此处找到的google教程运行下面的代码:https://cloud.google.com/docs/authentication/production

def implicit():
    from google.cloud import storage

    # If you don't specify credentials when constructing the client, the
    # client library will look for credentials in the environment.
    project = 'my_project_name'
    storage_client = storage.Client(project=project)

    # Make an authenticated API request
    buckets = list(storage_client.list_buckets())
    print(buckets)

implicit()
Run Code Online (Sandbox Code Playgroud)

但它一直给我以下错误:

Traceback (most recent call last):
  File "[PATH]/scratch_5.py", line 13, in <module>
    implicit()
  File "[PATH]/scratch_5.py", line 2, in implicit
    from google.cloud import storage
ImportError: cannot import name storage
Run Code Online (Sandbox Code Playgroud)

有人可以帮我吗?

python google-cloud-storage google-cloud-platform

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