我正在使用 gcloud SDK 在 Raspberry Pi 3 Raspbian OS 上测试 Google Cloud Speech API 命令行。Google 提供的标准程序在我的 Mac OSX 上运行!在 Raspbian 中尝试它失败了。
我尝试设置 ENV 变量,如“GOOGLE_APPLICATION_CREDENTIALS”和“GCLOUD_PROJECT”,当这不起作用时,我取消设置这些变量并尝试运行“gcloud beta init”而不是“gcloud init”。没有这些作品的组合。
命令:
curl -v -k -s -H "Content-Type: application/json" -H "Authorization: Bearer `gcloud auth print-access-token`" "https://speech.googleapis.com/v1beta1/speech:syncrecognize" -d @sync-request.json
(注意:'sync-request.json' 的内容,请参阅快速入门指南示例)。
我收到的错误消息如下所示。似乎选择了错误的项目:
输出:
{
"error": {
"code": 403,
"message": "Google Cloud Speech API has not been used in project google.com:cloudsdktool before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url": "https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool"
}
]
}
]
}
}