I tries to run python -m cProfile simple_test_script.py
. I'm on Windows 7, Python 2.7.10.
simple_test_script.py:
import numpy as np
from numpy.linalg import eigvals
def run_experiment(niter=100):
K = 100
results = []
for _ in xrange(niter):
mat = np.random.randn(K, K)
max_eigenvalue = np.abs(eigvals(mat)).max()
results.append(max_eigenvalue)
return results
some_results = run_experiment()
print 'Largest one we saw: %s' % np.max(some_results)
I get this error:
File "<ipython-input-13-6634cb53f497>", line 1
python -m cProfile simple_test_script.py
^
SyntaxError: invalid syntax
I read this documentation: https://docs.python.org/2/library/profile.html
(Use profile instead of cProfile if the latter is not available on your system.)
I tried profile instead of cProfile but the the same error. Any clues how i can call cProfile?