简体   繁体   English

如何将 Google App Engine 更新到 Python 3.8

[英]How to update Google App Engine to Python 3.8

My current Python version in GAE when running python3 --version is 3.7.3 , I want to upgrade it to 3.8 for a single service on GAE, I tried changing runtime in service.yaml to runtime: python38 but the version stays the same at 3.7.3我当前在 GAE 中运行的 Python 版本在运行python3 --version3.7.3时,我想将它升级到3.8以获得 GAE 上的单个服务,我尝试在service.yaml中将运行时更改为runtime: python38但版本保持不变3.7.3

when trying to run sudo apt install python3.8当尝试运行sudo apt install python3.8

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.8
E: Couldn't find any package by glob 'python3.8'
E: Couldn't find any package by regex 'python3.8'

yaml file yaml 文件

runtime: python38
entrypoint: gunicorn -w 8 -k uvicorn.workers.UvicornWorker servicename:app
instance_class: F4_1G
service: servicename

How can I upgrade to 3.8 for this service?我如何升级到3.8以获取此服务?

Solved, when printing the version inside the file using import sys print(sys.version) I get 3.8.6 , also the directory now showing /python3.8/ , thank you all.解决了,当使用import sys print(sys.version)文件中的版本时,我得到3.8.6 ,现在也显示目录/python3.8/ ,谢谢大家。

The Python 3.8 App Engine (Standard) runtime launched in Nov 2019 . Python 3.8 App Engine(标准)运行时于 2019 年 11 月推出 To access it, update your app.yaml to have runtime: python38 .要访问它,请更新您的app.yaml以拥有runtime: python38 (Similarly, Python 3.9 launched in Mar 2021 ; same adjustment: runtime: python39 .) (同样,Python 3.9 于 2021 年 3 月推出;同样的调整: runtime: python39 。)

Several other replies above show you how to check the running version which you can log, etc. Summarizing here and adding a few more so people don't have to dig into comments above:上面的其他几个回复向您展示了如何检查您可以记录的正在运行的版本等。在这里总结并添加更多,这样人们就不必深入研究上面的评论:

>>> import site; site.getsitepackages()
['/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages']
>>>
>>> import sys; sys.version
'3.9.1 (v3.9.1:1e5d33e9b9, Dec  7 2020, 12:10:52) \n[Clang 6.0 (clang-600.0.57)]'
>>>
>>> import sys; sys.version_info.major, sys.version_info.minor
(3, 9)
>>>
>>> import platform; platform.python_version(), platform.python_version_tuple()
('3.9.1', ('3', '9', '1'))

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

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