简体   繁体   English

永久升级Google Cloud Shell中的Python运行时?

[英]Permanently upgrade the Python runtime in Google Cloud Shell?

Running a small webapp written in Python 3.7 on Google App Engine (Standard). 在Google App Engine(标准)上运行一个用Python 3.7编写的小型Web应用。 Before deploying new builds, I test the app locally, then again in the GCP Shell using gunicorn . 在部署新版本之前,我先在本地测试该应用程序,然后再使用gunicorn在GCP Shell中进行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. 作为一个激动人心的新手,我最近发现了f字符串并将它们自由地应用于我的代码...而没有意识到shell运行的是Python 3.5。 Unless there's a way around this, the days of testing my app in the shell might be behind me. 除非有解决办法,否则在shell中测试我的应用程序的日子可能会过去。

I'm aware that the shell environment is ephemeral and gets reset shortly after each session. 我知道shell环境是短暂的,每次会话后不久都会重置。 Tried the pyenv method described here and discovered that all of those changes were lost between sessions, including my .bashrc edits. 试过pyenv方法描述这里 ,发现所有的这些变化是失去了会话之间,包括我.bashrc的编辑。

Is there a way to permanently upgrade the shell's Python runtime to 3.7+? 有没有办法将Shell的Python运行时永久升级到3.7+? Or perhaps an easier solution? 还是更简单的解决方案?

Cloud Shell is a Docker container. Cloud Shell是Docker容器。 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). 运行Cloud Shell时,查找看起来像笔记本电脑的工具栏图标(在启动编辑器图标旁边)。 Click the icon. 单击图标。 This will allow you to change your Cloud Shell environment. 这将允许您更改Cloud Shell环境。 Just follow the wizard. 只需按照向导操作即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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