Fundamentals 6 min read

An Introduction to Python Package Management Tools

This article provides a comprehensive overview of Python package management tools, explaining the roles and relationships of distutils, setuptools, distribute, easy_install, and pip, and includes practical examples and commands for installing and using these tools effectively.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
An Introduction to Python Package Management Tools

Python has many mature packages that can be installed to extend programs.

Developers often search PyPI for packages. PyPI is the Python Package Index for third‑party packages.

Package installation involves tools such as distutils, setuptools, distribute, setup.py, easy_install, and pip.

Python package management tools

Distutils is part of the standard library and provides a simple way to package and install modules via setup.py.

Example setup.py using distutils:

from distutils.core import setup
setup(
   name='fooBar',
   version='1.0',
   author='Will',
   author_email='[email protected]',
   url='http://www.cnblogs.com/wilber2013/',
   py_modules=['foo', 'bar'],
)

Running python setup.py sdist creates a source distribution zip file, which can be installed with python setup.py install .

setuptools and distribute

setuptools extends distutils with dependency management and supports .egg files; distribute was a fork that has merged back.

easy_install

easy_install, based on setuptools/distribute, can install packages from PyPI, local archives, or .egg files.

pip

pip is the most popular package manager, superseding easy_install and relying on setuptools for many functions. It supports installing, uninstalling, and installing from VCS URLs.

Common pip commands include pip install package , pip uninstall package , and pip --help for usage.

Summary

The article clarifies the relationships among Python's packaging tools, helping readers choose the appropriate tool for their needs.

Package ManagementSetuptoolspipdistutilseasy_install
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.