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

时间:2019-03-17 22:22:01

标签: python python-3.x google-cloud-storage

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 个答案:

答案 0 :(得分: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