How to set CLOUDSDK_PYTHON for Google Cloud in Linux?

Viewed 4478

if I run:

sudo gcloud components update

I get this warning:

WARNING: Python 3.4.x is no longer officially supported by the Google Cloud SDK and may not function correctly. Please use Python version 2.7.x or 3.5 and up.

If you have a compatible Python interpreter installed, you can use it by setting the CLOUDSDK_PYTHON environment variable to point to it.

My linux machine is Centos6 and my current python default versions are these:

myshell$ python --version
Python 2.6.6
myshell$ python3 --version
Python 3.4.10

I installed a Python 3.6 version, which is located here:

/opt/rh/rh-python36/root/usr/bin/python

myshell$ /opt/rh/rh-python36/root/usr/bin/python --version
Python 3.6.9

I hence added this line to the .bash_profile and sourced it:

export CLOUDSDK_PYTHON=/opt/rh/rh-python36/root/usr/bin/python

but I still get the same warning when running gcloud commands

Can anyone explain what am I doing wrong?

1 Answers

I think you can solve it do it the described here.

*Just go to the google-cloud-sdk folder and open the install.sh file.

*Change the CLOUDSDK_PYTHON="python" value to CLOUDSDK_PYTHON="python2.7"

*Rerun the install with the command

./install.sh
Related