简体   繁体   中英

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

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))

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM