'How to determine which libc implementation the host system uses

In our Python setup code that uses pre-built binaries and a bindings generator, we check the operating system and CPU architecture, and download binaries accordingly.

Now, there are binaries for both manylinux (glibc) and musllinux (musl). How can we find out which libc implementation the host system uses? I am aware of platform.libc_ver(), but for musl hosts, it currently just returns two empty strings (see CPython issue 87414).

However, there has to be more precise code available already, as pip needs means to choose the right wheel.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source