Installation¶
Installing coverage.py is done 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
The alternate old-school technique is:
- Install (or already have installed) setuptools or Distribute.
- Download the appropriate kit from the coverage.py page on the Python Package Index.
- Run
python setup.py install.
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
or for Python 3.x:
$ sudo apt-get install python3-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.py installed properly:
$ coverage --version Coverage.py, version 4.0a6. Documentation at https://coverage.readthedocs.org/en/4.0a6
You can also invoke coverage.py as a module:
$ python -m coverage --version Coverage.py, version 4.0a6. Documentation at https://coverage.readthedocs.org/en/4.0a6