coverage.py / doc / install.rst

Installation

history:20100725T225600, new for 3.4.
history:20100820T151500, updated for 3.4b1.
history:20100906T134800, updated for 3.4b2.
history:20110604T213400, updated for 3.5b1.
history:20110629T082400, updated for 3.5.
history:20110923T081900, updated for 3.5.1.
history:20120429T162500, updated for 3.5.2b1.
history:20120503T234000, updated for 3.5.2.
history:20120929T093600, updated for 3.5.3.
history:20121117T095000, Now setuptools is a pre-req.
history:20121128T203000, updated for 3.6b1.
history:20121223T180800, updated for 3.6b2.
history:20121229T112400, updated for 3.6b3.

Installing coverage.py is done in the usual ways. You must have setuptools or Distribute installed already, and then you:

  1. Download the appropriate kit from the coverage page on the Python Package Index.
  2. Run python setup.py install.

or, use:

$ pip install coverage

or even:

$ easy_install coverage

Installing from source

Coverage.py includes a C extension for speed. If you are installing from source, you may need to install the python-dev support files, for example with:

$ sudo apt-get install python-dev

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 coverage installed properly:

$ coverage --version
Coverage.py, version 3.6b3.  http://nedbatchelder.com/code/coverage/3.6b3

You can also invoke coverage as a module:

$ python -m coverage --version
Coverage.py, version 3.6b3.  http://nedbatchelder.com/code/coverage/3.6b3
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.