Python轮包Linux与Windows [英] Python wheel packages Linux vs windows

查看:103
本文介绍了Python轮包Linux与Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Linux,Windows等,可以使用相同的python软件包(wheel文件)吗?我之所以这么问,是因为有些软件包不仅包括python文件,还包括EXE,我认为是将python代码转换为exe(至少使用pip.exe和Django管理工具). Exe文件是特定于平台的,就像在Windows和Linux上有单独的python解释器一样,这引起了一个问题.

Can one use the same python package (wheel file) for Linux , windows etc.? I am asking this as some packages include not only python files but EXEs as well, which I assume are python code turned into exe (at least with pip.exe and Django admin tool). Exe files are platform specific in the same way there are separate python interpreters for windows and Linux so that arises a question.

推荐答案

某些轮包是跨平台的;有些是特定于平台的.

Some wheel packages are cross-platform; some are platform-specific.

此信息包含在转轮名称中.对于示例:

This information is included in the wheel's name. For example:

pytz-2018.4-py2.py3-none-any.whl (510kB)

py2.py3表示它可以在Python 2.x和3.x的任何Python实现中使用,而none-any表示它可以在任何平台上运行. 这个更为具体:

That py2.py3 means that it works in any Python implementation, both Python 2.x and 3.x, and that none-any means that it works on any platform. This one is more specific:

numpy-1.14.3-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

cp36-cp36m意味着它仅在CPython 3.6中有效,而macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64意味着它是针对x86_64 macOS版本10.9-10.10构建的. (粗略地说,这是macOS的最低和推荐版本;大多数其他平台并没有那么复杂.)

That cp36-cp36m means that it works only in CPython 3.6, and that macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64 means that it's built for x86_64 macOS versions 10.9-10.10. (Roughly speaking, that's the minimum and recommended versions of macOS; most other platforms aren't quite as complicated.)

软件包是特定于平台的最常见原因是它包括C API扩展模块,如numpy一样.但是可能还有其他原因.例如,它可能包含subprocess的本机可执行文件,或者可以使用ctypes访问系统API等.

The most common reason for a package to be platform-specific is that it includes C API extension modules, as is the case with numpy. But there can be other reasons. For example, it may include a native executable to subprocess, or it may use ctypes to access system APIs, etc.

这篇关于Python轮包Linux与Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆