Changing the underlying version of python is a huge upgrade. There is a big push to modernise the software stack in v3 of the software. You can try to use the v3 test images, the issue is that the images are only the “lite” version of the operating system.
Some of the discussion on this is happening in this software thread.
One slightly hacky way to do it would be to have a second version of python installed (using something like the deadsnakes
PPA). You could then have one 3.9+ version of python doing you code while the server runs in a different python version and environment.