为什么线探查器仅显示部分结果?

发布于 2025-02-09 18:45:14 字数 1063 浏览 1 评论 0原文

我的行Profiler %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 \我的名字\ anaconda3 \ lib \ lib \ site-packages \ line_profiler \ ipython_extension.py

这里的解决方案是什么?

我尝试但失败的事情是: 1。重新安装line_profiler与我的代码相同的目录中。 2。尝试在我的代码目录中复制ipython_extension.py,但无法找到任何appdata文件夹 3。创建我的代码的.py文件,然后重新运行程序

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文