简体   繁体   English

如何声明“ GOOGLE_APPLICATION_CREDENTIALS”环境变量?

[英]How to declare the `GOOGLE_APPLICATION_CREDENTIALS` environment variable?

I am trying the QuickStart project of the .NET Google Cloud Speech API Samples on my PC (Windows with Visual Studio 2017) but I can't figure where I have to define the GOOGLE_APPLICATION_CREDENTIALS that must contains the path to the JSON account key file. 我正在PC(Windows和Visual Studio 2017的Windows)上尝试.NET Google Cloud Speech API Samples的QuickStart项目 ,但无法确定必须定义GOOGLE_APPLICATION_CREDENTIALS ,该位置必须包含JSON帐户密钥文件的路径。

When I run the project in Visual Studio 2017 it fails on this exception: 当我在Visual Studio 2017中运行项目时,此异常失败:

System.InvalidOperationException: 'The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.'

I have tried to define the GOOGLE_APPLICATION_CREDENTIALS environment variable in the system properties (under User variables and System variables ) like that: 我试图在系统属性(在用户变量系统变量下 )中定义GOOGLE_APPLICATION_CREDENTIALS环境变量,如下所示:

C:\GCP_ApiKey\MyFirstProject-599bf9a10431.json

But it doesn't work. 但这是行不通的。

Where have I to define GOOGLE_APPLICATION_CREDENTIALS ? 我在哪里定义GOOGLE_APPLICATION_CREDENTIALS

实际上,我只需要重新启动PC即可考虑环境变量…🙄

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM