My line profiler %lprun -f
works but does not show the line contents but only the numbers. So it is useless for me. It shows some directory problem as below.
Timer unit: 1e-07 s
Total time: 0.962042 s
Could not find file C:\Users\my name\AppData\Local\Temp\ipykernel_20788\3519952779.py
Are you sure you are running this program from the same directory
that you ran the profiler from?
Continuing without the function's contents.
Line # Hits Time Per Hit % Time Line Contents
==============================================================
1
2 1 24.0 24.0 0.0
3 6 211.0 35.2 0.0
And when I run %lprun?
i see it's directory is c:\users\my name\anaconda3\lib\site-packages\line_profiler\ipython_extension.py
What is the solution here?
Things I tried but failed: 1. Re-installing line_profiler in the same directory as my code. 2. Trying to copy-paste the ipython_extension.py inside my code directory but couldn't locate any AppData folder 3. Create a .py file of my code and then re-run the program