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 as f-strings).
I try various forms of the following:
sudo apt-get install python37
and always get back
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python37
Any help would be really appreciated!
# install pyenv to install python on persistent home directory
curl https://pyenv.run | bash
# add to path
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
# updating bashrc
source ~/.bashrc
# install python 3.7.4 and make default
pyenv install 3.7.4
pyenv global 3.7.4
# execute
python
This is based on @yungchin answer.