简体   繁体   中英

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

when trying to run 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

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?

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.

The Python 3.8 App Engine (Standard) runtime launched in Nov 2019 . To access it, update your app.yaml to have runtime: python38 . (Similarly, Python 3.9 launched in Mar 2021 ; same adjustment: 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'))

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