You can install in the usual ways. The simplest way is with pip:

$ pip install coverage

To install a pre-release version, you will need to specify --pre:

$ pip install --pre coverage

C Extension includes a C extension for speed. It is strongly recommended to use this extension: it is much faster, and is needed to support a number of features. Most of the time, the C extension will be installed without any special action on your part.

If you are installing on Linux, you may need to install the python-dev and gcc support files before installing coverage via pip. The exact commands depend on which package manager you use, which Python version you are using, and the names of the packages for your distribution. For example:

$ sudo apt-get install python-dev gcc
$ sudo yum install python-devel gcc

$ sudo apt-get install python3-dev gcc
$ sudo yum install python3-devel gcc

You can determine if you are using the extension by looking at the output of coverage --version:

$ coverage --version, version |release| with C extension
Documentation at

The first line will either say “with C extension,” or “without C extension.”

A few features of aren’t supported without the C extension, such as concurrency and plugins.

Installing on Windows

For Windows, kits are provided on the PyPI page for different versions of Python and different CPU architectures. These kits require that setuptools be installed as a pre-requisite, but otherwise are self-contained. They have the C extension pre-compiled so there’s no need to worry about compilers.

Checking the installation

If all went well, you should be able to open a command prompt, and see installed properly:

$ coverage --version, version 5.0a4 with C extension
Documentation at

You can also invoke as a module:

$ python -m coverage --version, version 5.0a4 with C extension
Documentation at