Skip to main content
 首页 » 编程设计

python之memory_profiler 的 mprof 未运行

2025年02月15日7lvdongjie

我使用 pip install -U memory_profiler 通过 pip 安装 memory_profiler 并尝试使用 mprof 使用: mprof 运行 mprof 图

但是得到如下错误:

ERROR-mprof is not recognised as an internal or external command.

有解决办法吗?

正在使用 Python 3.5 版本。

注意:这不是重复的。之前有过类似的问题,但还没有答案!

请您参考如下方法:

我能够运行它。您是否使用与运行 pip install memory_profiler 时相同的虚拟环境?

mprof 运行输出一个 .dat 文件,该文件由 mprof plot 读取。因此,本质上,这是 2 个独立的命令。

mprof plot 不适用于 Mac OS,因为我们需要 python 框架版本。更多详情来自 here .