Issue with 'google.cloud.storage'. module has no attribute 'Client'

流过昼夜 提交于 2021-01-28 04:08:41

问题


Trying to simply connect to the google-cloud-storage using these instructions;

https://googleapis.github.io/google-cloud-python/latest/storage/index.html

However, I keep getting the problem with the storage module, no client attribute.

from google.cloud import storage
# Instantiates a client
storage_client = storage.Client(credentials=creds, project='name')
# The name for the new bucket
bucket_name = 'my-new-bucket'
# Creates the new bucket
bucket = storage_client.create_bucket(bucket_name)
print('Bucket {} created.'.format(bucket.name))

回答1:


This is a problem I've seen several times, and happens as well in other google.cloud modules. Most of the time it is related to a broken installation

Try to uninstall and then installgoogle.cloud packages. If no luck, try to use it on a newly created virtual environment (this will work for sure)

Related git issue with same solution



来源:https://stackoverflow.com/questions/55212535/issue-with-google-cloud-storage-module-has-no-attribute-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!