【发布时间】:2022-10-20 15:50:23
【问题描述】:
我的线分析器%lprun -f 工作但不显示行内容但只有数字。所以对我来说没用。它显示了一些目录问题,如下所示。
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
当我运行%lprun? 时,我看到它的目录是c:\users\my name\anaconda3\lib\site-packages\line_profiler\ipython_extension.py
这里的解决方案是什么?
我尝试但失败的事情: 1.在与我的代码相同的目录中重新安装 line_profiler。2.尝试将 ipython_extension.py 复制粘贴到我的代码目录中,但找不到任何 AppData 文件夹3.创建我的代码的 .py 文件,然后重新运行程序
【问题讨论】:
标签: python jupyter-notebook ipython profiling line-profiler