首页 > 解决方案 > 调用 line_profiler 时没有名为“line_profiler._line_profiler”的模块

问题描述

我打算在 Pycharm 中按以下方式使用 line_profiler 测试我的代码,但得到了一个错误,就像标题所说的那样。我在 miniconda 3.8 和 python 3.7 (Windows) 中都尝试过,但遇到了同样的错误,我不知道如何解决。我访问了源代码所在的 github 页面,还尝试将我的 python 文件作为脚本运行。最后,由于这个错误,所有尝试都失败了。这似乎是一个错误,但我发现 Colab 中一切正常。谁能给我任何建议?随时发表评论,我将不胜感激。

    lp = LineProfiler()
    lp_wrapper = lp(Solution) # Solution is the name of self-defined function
    lp_wrapper()
    lp.print_stats()

标签: python-3.xline-profiler

解决方案


推荐阅读