Is there a way to use gcloud with python3?

I am a little confused in gcloud with python3

After I installed gcloud in python3 env, I tried to give a Quickstart example for Python in a flexible App Engine environment .

He said, “You need the Google Cloud SDK,” so I installed the SDK. The whole process after the SDK (including the SDK), it needs python2 env.

Here's the question: is it not possible to run gcloud with python3 (officially)? (SDK and python2 with gcloud library - best way?)

+7
python google-app-engine google-cloud-platform gcloud
source share
3 answers

I worked on this issue by specifying the path to Python 2 (which I named python2 on my system).

 $ export CLOUDSDK_PYTHON=$(which python2) $ ./install.sh 

I suggest adding an export to your .bashrc or .zshrc .

+6
source share

gcloud-python and gcloud-cli, as in the Cloud SDK, are somewhat unrelated products. It is true that you need python 2.7.x to run gcloud-cli, but that does not stop you from using python3 with the gcloud-python library.

If you install multiple versions of python 2.7x and 3.5, for example (you can even make python3 the default) while you set the CLOUDSDK_PYTHON environment variable to point to the python 2.7.x interpreter, you should be able to run gcloud-cli while using python3 for your project.

On Windows, for example, the Cloud SDK packs its own python, which does not conflict with any other version that you might have on your system. This is a pure runtime dependency for gcloud-cli.

+3
source share

The system requirement is explicitly specified by python 2.7.x https://cloud.google.com/sdk/downloads

Why do you still want to run gcloud with python3?

0
source share

All Articles