【问题标题】:How to declare the `GOOGLE_APPLICATION_CREDENTIALS` environment variable?如何声明 `GOOGLE_APPLICATION_CREDENTIALS` 环境变量?
【发布时间】:2018-05-02 14:34:54
【问题描述】:

我正在我的 PC(带有 Visual Studio 2017 的 Windows)上尝试 .NET Google Cloud Speech API 示例的 QuickStart project,但我无法确定必须在哪里定义必须包含路径的 GOOGLE_APPLICATION_CREDENTIALS JSON 帐户密钥文件。

当我在 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.'

我曾尝试在系统属性中定义GOOGLE_APPLICATION_CREDENTIALS 环境变量(在用户变量系统变量下),如下所示:

C:\GCP_ApiKey\MyFirstProject-599bf9a10431.json

但它不起作用。

我在哪里定义GOOGLE_APPLICATION_CREDENTIALS

【问题讨论】:

    标签: windows google-cloud-platform environment-variables credentials google-speech-api


    【解决方案1】:

    事实上,我只需要重新启动 PC 就可以将环境变量考虑在内……?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-01
      • 2021-04-26
      • 2019-09-01
      • 2017-07-12
      • 1970-01-01
      相关资源
      最近更新 更多