The Distribution Utilities (distutils)
Python modules, extensions, and applications can be packaged and distributed in several forms:
- Compressed archive files
Generally
.zipfor Windows and.tar.gzor.tgzfor Unix-based systems, but both forms are portable- Self-unpacking or self-installing executables
Normally
.exefor Windows- Platform-specific installers
For example,
.msion Windows,.rpmand.srpmon Linux, and.debon Debian GNU/Linux
When you distribute a package as a self-installing executable or platform-specific installer, a user can then install the package simply by running the installer. How to run such an installer program depends on the platform, but it no longer matters what language the program was written in.
When you distribute a package as an archive file or as an executable
that unpacks but does not install itself, it does matter that the
package was coded in Python. In this case, the user must first unpack
the archive file into some appropriate directory, say
C:\Temp\MyPack on a Windows machine or
~/MyPack on a Unix-like machine. Among the
extracted files there should be a script, conventionally named
setup.py, that uses the Python facility known as
the distribution utilities (package
distutils). The distributed package is then almost
as easy to install as a self-installing executable would be. The user
opens a command-prompt window and changes to the directory into which
the archive is unpacked. Then the user runs, for
example:
C:\Temp\MyPack>pythonsetup.py ...