python - 'google.cloud.storage' 问题。模块没有属性 'Client'

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

尝试使用这些说明简单地连接到 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 软件包。如果运气不好,请尝试在新创建的虚拟环境中使用它(这肯定会起作用)

Related git issue with same solution

关于python - 'google.cloud.storage' 问题。模块没有属性 'Client',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55212535/

相关文章:

python - 无法分配 "...' ": "..." must be a "User" instance

Python 列表理解条件过滤器语法

python - Pytorch 中对张量进行上采样并将其转换为 RGB 的最佳方法?

python - 如果字符串由单词列表中的单词组成,则匹配没有空格的字符串

java - 如何在访问 Google Drive API 时隐藏/绕过授权弹出窗口

python - SQLAlchemy 将表联合映射到类

Python: webbrowser.open ("") 打开文件资源管理器窗口

python - 在 pandas.read_csv() 中使用自定义对象

electron - 有没有办法设置 electron-builder 自动更新程序来检查来自 Google Cloud Storage 的更新?

ios - 上传谷歌云存储 iOS