简体   繁体   中英

Permanently upgrade the Python runtime in Google Cloud Shell?

Running a small webapp written in Python 3.7 on Google App Engine (Standard). Before deploying new builds, I test the app locally, then again in the GCP Shell using gunicorn .

Being an excitable newbie, I recently discovered f-strings and applied them liberally to my code... without realizing that the shell runs Python 3.5. Unless there's a way around this, the days of testing my app in the shell might be behind me.

I'm aware that the shell environment is ephemeral and gets reset shortly after each session. Tried the pyenv method described here and discovered that all of those changes were lost between sessions, including my .bashrc edits.

Is there a way to permanently upgrade the shell's Python runtime to 3.7+? Or perhaps an easier solution?

Cloud Shell is a Docker container. You can change this container to fit your needs.

When you have Cloud Shell running, look for the toolbar icon that looks like a laptop (next to the launch editor icon). Click the icon. This will allow you to change your Cloud Shell environment. Just follow the wizard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM