The line profiler is from https://github.com/rkern/line_profiler.git.
pip install line_profiler
Note that it will install a binary command ''kernprof'' and a python library module ''line_profiler''.
kernprof -l example.py
Note that @profile decorator is used to define the functions we want to perform profiling in the python script. The output file after the execution is example.py.lprof.
python -m line_profiler example.py.lprof