Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python wheel packages Linux vs windows

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.

like image 529
G.Bar Avatar asked Jan 28 '23 03:01

G.Bar


1 Answers

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)

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

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.)


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.

like image 136
abarnert Avatar answered Jan 31 '23 11:01

abarnert