Python profiler visualization on Windows

I need to run a python profiler tool and get a visualization of that. For this a simple code is used as follows:

import cProfile, pstats, io
from pstats import SortKey
pr = cProfile.Profile()
pr.enable()
s=0
for i in range(10):
    s=s+i
print(s)
pr.disable()
s = io.StringIO()
sortby = SortKey.CUMULATIVE
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())

The output of the code is as follows:

45

2 function calls in 0.000 seconds

Ordered by: cumulative time

ncalls tottime percall cumtime percall filename:lineno(function)

1 0.000 0.000 0.000 0.000 {built-in method builtins.print}

1 0.000 0.000 0.000 0.000 {method ‘disable’ of ‘_lsprof.Profiler’ objects}

This can be saved as a .pstats file in Linux using the following command: python3 -m cProfile -o test.pstats pro1.py After this an image file can be obtained that shows the profile using the Linux command:

gprof2dot -f pstats test.pstats | dot -Tpng -o output.png

NOTE that graphviz and gprof2dot must be installed in the setup.

Now the problem is that after first step, I am unable to execute the next two steps in Windows 10.

The mentined seteps are as mentioned in :

I have used graphviz before with Protege (Ontology Editor)…

Can anyone help me?

Lastly, if this cannot be done in Windows, Please let me know…