Reputation: 48446
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
Upvotes: 3
Views: 6226
Reputation: 11
For c(Recommended):
cat > get_zlib_version.c << EOF
#include<stdio.h>
#include<zlib.h>
int main()
{
printf("%s", ZLIB_VERSION);
return 0;
}
EOF
gcc get_zlib_version.c -o get_zlib_version && ./get_zlib_version
For Python 2.x:
# only show zlib version used for building the module, this may be different from the zlib library actually used at runtime
python -c "import zlib; print(zlib.ZLIB_VERSION)"
For Python 3.x:
# The version string of the zlib library actually loaded by the interpreter.
python -c "import zlib; print(zlib.ZLIB_RUNTIME_VERSION)"
https://docs.python.org/3/library/zlib.html
Upvotes: 1
Reputation: 33
Try the command below to see whether the zlib Python package is available and which version it has:
python -c "import zlib; print(zlib.__version__)"
python3 -c "import zlib; print(zlib.__version__)"
Upvotes: 1
Reputation: 114946
It is zlib.ZLIB_VERSION
:
>>> import zlib
>>> zlib.ZLIB_VERSION
'1.2.7'
Upvotes: 4