line_profiler
was created by one of the NumPy developers. This module does line-by-line profiling of Python code. We will describe the necessary installation steps in this recipe.
You might need to install setuptools
. This is covered in a previous recipe; refer to the See Also section if necessary. In order to install the development version, you will need Mercurial. Installing Mercurial is outside the scope of this book. Steps to install Mercurial can be found at http://mercurial.selenic.com/wiki/Download.
Choose the install option appropriate for you:
easy_install
.You can install line_profiler
with easy_install
by using any one of the following commands:
easy_install line_profiler pip install line_profiler
We can check out the source with Mercurial:
$ hg clone https://bitbucket.org/robertkern/line_profiler
After checking out the source, we can build it as follows:
$ python setup.py install