尝试使用这些说明简单地连接到 google-cloud-storage;
https://googleapis.github.io/google-cloud-python/latest/storage/index.html
但是,我不断遇到存储模块的问题,没有客户端属性。
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))
最佳答案
这个问题我已经见过好几次了,并且在其他 google.cloud 模块中也会发生。大多数时候它与损坏的安装有关
尝试卸载然后安装google.cloud 软件包。如果运气不好,请尝试在新创建的虚拟环境中使用它(这肯定会起作用)
关于python - 'google.cloud.storage' 问题。模块没有属性 'Client',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55212535/