python - 无法从 google.cloud 导入存储
问题描述
我是 Google Cloud Platform 的新手,并且已经在 DataLab 的 Jupyter notebook 上上传了一些机器学习代码。
我的问题是,虽然我安装了谷歌云存储(使用命令:)pip install --upgrade google-cloud-storage
,但我无法导入它。
以下是我如何导入这个包:
>>import numpy
>>import pandas as pd
>>from google.cloud import storage
但我收到以下错误:
ImportErrorTraceback (最近一次调用最后一次) in () ----> 1 from google.cloud import storage
ImportError:无法导入名称存储
笔记:
- 这是我的 JSON 配置文件的内容:
{"TokenSources":["env"]}
- 我试过
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/file.json"
了,但错误仍然存在。 - 我通过在命令 shell 中键入 pip freeze 验证了这个包确实安装在我的环境中:
谷歌云==0.34.0
谷歌云数据存储==1.7.0
谷歌云扳手==1.4.0
谷歌云存储==1.10.0
我在这里想念什么?
解决方案
所以我让它在导入存储时工作,如下所示:
导入 google.datalab.storage 作为存储
推荐阅读
- flutter - 发生 Android Studio IDE 内部错误 Error says Unable to serialize DslActivationStatus state
- python - 如何从模型中获取 masklen
- mysql - Mysql debezium connector for rds in production 导致死锁
- java - 如何使用组分隔符解析 GS1 条码?
- flutter - 颤振中有垂直导航栏的选项吗?
- mysql - 在 mySQL 中使用 json_array 拆分数组中的 json 元素
- c# - Bind a WPF ComboBox Based on Data From Another ComboBox Using JSON in C#
- python - matplotlib 中日期时间轴的格式
- java - 检查包含整数值的列表时如何处理 HQL 查询中的空值
- sql - 无法在 impala 查询中同时使用 select distinct 和 group by