如何确定主机系统使用的LIBC实现
在使用预构建的二进制文件和绑定生成器的Python设置代码中,我们检查操作系统和CPU架构,并相应地下载二进制文件。
现在,Manlinux(Glibc)和Muslinux(Musl)都有二进制文件。我们如何找出主机系统使用的LIBC实现? 我知道platform.libc_ver()
,但是对于Musl主机,它目前只是返回两个空字符串(请参见 cpython问题87414 )。
但是,已经有更精确的代码可用,因为pip
需要选择正确的车轮。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我现在正在使用的解决方案。它是由 @andrewnelson的答案刺激的,还使用了平台模块,但它作为
platform.libc_ver()
的覆盖作品写入,并直接呼叫到packaging._musllinux
。This is the solution I am using now. It is insipred by @AndrewNelson's answer and also uses the platform module, but it is written as an overlay for
platform.libc_ver()
and calls intopackaging._musllinux
directly.如果您只是在检查glibc vs musl,为什么不只是:
If you are just checking for glibc vs musl, why not just: