无法从 google.cloud 导入存储

gre*_*lin 5 python google-cloud-platform google-cloud-datalab jupyter-notebook

我是 Google Cloud Platform 的新手,并且已在 DataLab 的 Jupyter Notebook 上上传了一些机器学习代码。

我的问题是,虽然我安装了 Google Cloud Storage(使用命令:)pip install --upgrade google-cloud-storage,但无法导入它。

以下是我导入此包的方式:

>>import numpy    
>>import pandas as pd   
>>from google.cloud import storage
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

() 中的 ImportErrorTraceback(最近一次调用最后一次)----> 1 from google.cloud import storage

ImportError:无法导入名称存储

笔记:

  1. 这是我的 JSON 配置文件的内容:{"TokenSources":["env"]}
  2. 我试过export GOOGLE_APPLICATION_CREDENTIALS="/path/to/file.json",但错误仍然存​​在。
  3. 我通过在命令 shell 中输入 pip freeze 来验证该软件包确实安装在我的环境中:

谷歌云==0.34.0

谷歌云数据存储==1.7.0

谷歌云扳手==1.4.0

谷歌云存储==1.10.0


我在这里缺少什么?

Dus*_*ram 3

您是否已google-cloud-storage在 DataLab 环境或本地计算机上安装了该软件包?您需要在 DataLab 中运行以下命令:

!pip install google-cloud-storage
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息,请参阅https://cloud.google.com/datalab/docs/how-to/adding-libraries

此外,该google-cloud软件包已被弃用,您不需要安装它,请参阅https://pypi.org/project/google-cloud/