سؤال

I have a package that I have registered on Pypi. However when I do sudo pip install mypackage from ubuntu it gives me the windows package rather than the linux one. How do you configure your package to give the right version for the right OS?

هل كانت مفيدة؟

المحلول

pip does not support installing packages distributed as '"dumb" binaries'. Only source distributions, eggs and wheels are supported.

There are various other drawbacks to using dumb binaries, not least in that the Python version for which they were compiled is not listed, and they contain the full path to the files making these distributions next to useless to most end-users. Such binaries should really only be used in internal distributions where the target machines have the exact dependencies already present. They don't really have any place on PyPI.

Use setuptools and distribute eggs for Windows, only. For all other platforms, distribute just the source. If you are planning on providing a wheel distributions too, do so in addition to the source distribution.

Eggs with compiled C extensions have some drawbacks (specifically when having to support Unicode strings; Python has both wide and narrow Unicode builds and eggs don't record what version they were compiled for), so sticking to source distributions for most platforms is best.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top