简体   繁体   English

Jupyter Notebook:访问谷歌云 API

[英]Jupyter Notebook: Access Google Cloud API

I am running my Jupyter notebooks locally via Docker ( jupyter/scipy-notebook )我正在通过 Docker ( jupyter/scipy-notebook ) 在本地运行我的 Jupyter 笔记本

So far I always accessed APIs by saving the credentials in the.env file where the Dockerfile lives.到目前为止,我总是通过将凭据保存在 Dockerfile 所在的 .env 文件中来访问 API。 However, now I start working with Google Cloud and the private keys are "handed over" to me in a private key JSON file .但是,现在我开始使用 Google Cloud,并且私钥在私钥 JSON 文件中“移交”给我。 I now wonder how that works together with the.env I am currently using.我现在想知道它如何与我目前使用的 .env 一起工作。 Can I just insert the path to the file in my.env file?我可以在 my.env 文件中插入文件的路径吗? Probably not... but I currently have no better idea.可能不会……但我目前没有更好的主意。

As far as I remember, you will have to create an environment variable called GOOGLE_APPLICATION_CREDENTIALS and the value is the path to that JSON file key you've got.据我记得,您必须创建一个名为GOOGLE_APPLICATION_CREDENTIALS的环境变量,其值是您拥有的 JSON 文件密钥的路径。

The GOOGLE_APPLICATION_CREDENTIALS is the default name Google libraries will look for in determining the path to the key. GOOGLE_APPLICATION_CREDENTIALS是 Google 库在确定密钥路径时将查找的默认名称。 This is done when you create an instance of the specific client library.这在您创建特定客户端库的实例时完成。

Here's a link.这是一个链接。 Section Setting the environment variable talks about it.设置环境变量一节谈到了它。 https://cloud.google.com/docs/authentication/getting-started https://cloud.google.com/docs/authentication/getting-started

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何配置虚拟机以在 Google Cloud Platform 上通过 Web 访问 jupyter notebook? - How to configure a VM for web access to jupyter notebook on Google Cloud Platform? 在Google Cloud上的Docker图像中运行Jupyter笔记本 - Running Jupyter notebook in docker image on Google Cloud 尝试从Jupyter Notebook使用Spark访问Google Cloud Bigtable时出现区域错误 - Region Error when trying to access Google Cloud Bigtable with Spark from a Jupyter Notebook 如何设置 Google API 凭据以通过 Jupyter Notebook 访问 AutoML API? - How to set Google API credentials to access the AutoML API through a Jupyter notebook? 在 Google Cloud Platform 中使用 jupyter notebooks 的 Python 模块和包 - Python Modules & Packages using jupyter notebook in Google Cloud Platform 在Jupyter笔记本中安装google-cloud-bigquery - Installing google-cloud-bigquery within a Jupyter notebook 我如何使用谷歌云自动化我的 jupyter notebook? - How do i automate my jupyter notebook using google cloud? 在 Google Cloud Datalab 中使用 jupyter notebook 时死了 Kernel - Dead Kernel while working on jupyter notebook in Google Cloud Datalab 在计算机睡眠时保持Google Cloud Jupyter Notebook运行 - Keep Google Cloud Jupyter Notebook Running while computer sleeps Google Cloud 无法从 Jupyter Notebook 保存 Tensorflow model - Google Cloud can't save Tensorflow model from Jupyter Notebook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM