Google Cloud SDK:Python 未找到

Google Cloud SDk: Python was not found

在我的电脑上安装 Google cloud sdk 后,我打开终端并输入“gcloud --version”,但它显示“python 未找到”

注意: 我在安装 Google cloud sdk 时取消选中“安装 python 捆绑包”框,因为我已经安装了 python 3.10.2。

那么,如何解决这个问题?

提前致谢。

document所述:

Cloud SDK requires Python; supported versions are Python 3 (preferred, 3.5 to 3.8) and Python 2 (2.7.9 or later). By default, the Windows version of Cloud SDK comes bundled with Python 3 and Python 2. To use Cloud SDK, your operating system must be able to run a supported version of Python.

正如@John Hanley 所建议的那样,CLI 无法找到已安装的 Python。尝试重新安装 CLI 选择 install Python bundle。如果您仍然面临这个问题,另一个解决方法是尝试使用 Python 版本 2.x.x .

您可以按照以下步骤操作:

1.Uninstall 所有 Python 版本 3 及以上。

2.InstallPython版本-2.x.x(我已经安装了-2.7.17)

3.Create 环境变量 - CLOUDSDK_PYTHON 并提供值 C:\Python27\python.exe

4.Run GoogleCloudSDKInstaller.exe 再一次。