运行 psqworker 时“无法从 Cloud SDK 配置确定项目 ID”

rar*_*ara 4 google-app-engine-python app-engine-flexible

当我浏览 Google Cloud 教程时:https://cloud.google.com/python/getting-started/using-pub-sub#running_the_app_on_your_local_machine

我收到以下错误:

google.auth._default 无法从 Cloud SDK 配置中确定项目 ID。考虑运行gcloud config set project或设置 GOOGLE_CLOUD_PROJECT 环境变量

我执行了“gcloud config set project [我的项目名称]”但没有成功。

有什么问题?

更新:我之前已经部署了应用程序引擎,没有任何问题。仅当我为此 Pub/Sub 功能运行 psqworker 时,才会出现此问题。我知道我的项目 ID 并且之前使用过它。

Kev*_*inG 6

我要尝试的第一件事是:

gcloud info

这将告诉您 gcloud 当前设置的帐户和项目。

您还可以使用以下 gcloud 命令查找您帐户的可用项目:

gcloud projects list