I have python 3.5 on my google cloud shell and want 3.7 so I can do command line debugging of code I am going to deploy via google cloud functions (and use 3.7 features such
Even if the packages were available through apt, the downside of using apt would be that you'd have to install all over again whenever you'd been disconnected from Cloud Shell: it always discards your runtime container.
I'd recommend using https://github.com/pyenv/pyenv for convenience. If you follow the installation guide (and note the bash profile additions should go into .bashrc
in our case) you end up with a python build in your home directory, which is persisted across Cloud Shell sessions. This involves just a few steps:
~/.pyenv
.bashrc
to adjust your $PATH
pyenv install 3.7.3
# this takes a while to buildpyenv global 3.7.3
# sets this version as the default