Search code examples
pythoncincludezlibshared-libraries

Tell what version of zlib python was built with


How can I tell what version of the C library python's zlib module was built with?

Specifically, I want to tell whether it was a new enough version to support ZLIB_RSYNC=1

This is different than the version of the zlib python module, but instead the version of the underlying C library


Solution

  • It is zlib.ZLIB_VERSION:

    >>> import zlib
    >>> zlib.ZLIB_VERSION
    '1.2.7'