'Google Cloud SDk: Python was not found

After I install Google cloud sdk in my computer, I open the terminal and type "gcloud --version" but it says "python was not found"

note: I unchecked the box saying "Install python bundle" when I install Google cloud sdk because I already have python 3.10.2 installed.

so, how do fix this?

Thanks in advance.



Solution 1:[1]

As mentioned in the 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.

As suggested by @John Hanley the CLI cannot find Python which is already installed. Try reinstalling the CLI selecting install Python bundle. If you are still facing the issue another workaround can be to try with Python version 2.x.x .

You can follow the below steps :

1.Uninstall all Python version 3 and above.

2.Install Python version -2.x.x (I have installed - 2.7.17)

3.Create environment variable - CLOUDSDK_PYTHON and provide value as C:\Python27\python.exe

4.Run GoogleCloudSDKInstaller.exe again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fariya Rahmat