installing latest Python on google cloud’s Debian

The latest Python version that apt is letting me install is Python 3.7.3 –

python3 is already the newest version (3.7.3-1).

PPA deadsnakes is meant for Ubuntu and I’d thus like to avoid it for now.

I tried pyenv for installing the latest Python, but I got the following exception –

Traceback (most recent call last):
  File "", line 601, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'

To fix that, I found advice to install the zlib1g-dev package:

sudo apt install zlib1g-dev

But this returns:

E: Unable to locate package zlib1g-dev

Is there perhaps something wrong with /etc/apt/sources.list?

deb https://deb.debian.org/debian buster main
deb-src https://deb.debian.org/debian buster main
deb https://deb.debian.org/debian-security buster/updates main
deb-src https://deb.debian.org/debian-security buster/updates main
deb https://deb.debian.org/debian buster-updates main
deb-src https://deb.debian.org/debian buster-updates main
deb https://deb.debian.org/debian buster-backports main
deb-src https://deb.debian.org/debian buster-backports main

Any idea on how to install that missing dependency? Or, perhaps an alternative way to install the latest Python?

(I’ve tried many, many other things that I am not listing here.)

Read more here: Source link