How can i update zlib version to 1.2.12 in linux

I’m a newbie to python, also linux. Now i need to using the zlib 1.2.12 in python for some reason. From the release notes of python 1.10.3, python builtin lib zlib has updated to 1.2.12 for windows. So I just need to update python to the latest version in windows。But linux is not mentioned at all. For linux, how can i update zlib in python? python uses zlib installed by others in linux?

That depends entirely on how you installed Python on your Linux system. If it was installed using the distribution’s packages, then the distribution is in control of the version of zlib that Python will use.

Thanks a lot for the answer! We are using ubuntu exactly, and there are two methods to intall python. As for the install methods you mentioned, is there any deiffrence :

  1. install dependencies using apt, then install python using source code:
    sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libbz2-dev liblzma-dev sqlite3 libsqlite3-dev tk-dev uuid-dev libgdbm-compat-dev
    wget https://www.python.org/ftp/python/3.x.x/Python-3.x.x.tar.xz

    2.upodate packages and install uing apt
    sudo apt update
    sudo apt install software-properties-common

    sudo apt install python3.x

Yes, those are very different. In #1 you are building your own installation from source and can choose how it is built, which dependencies are used, etc. In #2, you are using the distribution’s packages, and all of those decisions have been made already.