distutils — Building and installing Python modules


Thedistutils package provides support for building and installingadditional modules into a Python installation. The new modules may be either100%-pure Python, or may be extension modules written in C, or may becollections of Python packages which include modules coded in both Python and C.

Most Python users willnot want to use this module directly, but insteaduse the cross-version tools maintained by the Python Packaging Authority. Inparticular,setuptools is anenhanced alternative todistutils that provides:

  • support for declaring project dependencies

  • additional mechanisms for configuring which files to include in sourcereleases (including plugins for integration with version control systems)

  • the ability to declare project “entry points”, which can be used as thebasis for application plugin systems

  • the ability to automatically generate Windows command line executables atinstallation time rather than needing to prebuild them

  • consistent behaviour across all supported Python versions

The recommendedpip installer runs allsetup.py scripts withsetuptools, even if the script itself onlyimportsdistutils. Refer to thePython Packaging User Guide for moreinformation.

For the benefits of packaging tool authors and users seeking a deeperunderstanding of the details of the current packaging and distributionsystem, the legacydistutils based user documentation and APIreference remain available: