Google Cloud SDk: Python was not found
Question:
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.
Answers:
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:Python27python.exe
4.Run GoogleCloudSDKInstaller.exe again.
On ubuntu Linux, you can define this variable in the .bashrc
file:
export CLOUDSDK_PYTHON=/usr/bin/python3
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.
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:Python27python.exe
4.Run GoogleCloudSDKInstaller.exe again.
On ubuntu Linux, you can define this variable in the .bashrc
file:
export CLOUDSDK_PYTHON=/usr/bin/python3