2

运行kernprof时:

kernprof -l script_to_profile.py

输出存储在二进制文件中,可以在终端/命令行中读取。

有没有办法将结果输出到文本文件?

这似乎是有用的功能,但在文档或其他帖子中找不到。

4

1 回答 1

1
python -m line_profiler script_to_profile.py.lprof > profile_output.txt

将二进制输出转换为文本文件(感谢@martineau)

于 2019-05-08T11:32:16.050 回答