试图用pip安装cProfile,我收到一个错误

6 python pip cprofile python-3.x

所以我到处寻找有关如何安装cProfile的帮助,但我什么都没发现.当这种情况经常发生时,我转向pip并运行通常的:'pip install [module name]'但是我收到错误:找不到匹配的cprofile发行版.

我不知道如何安装cProfile,我到处都看.我很少转向StackOverflow,当我这样做时,我彻底搜索了这样一个问题.

任何帮助,将不胜感激.

速记问题:如何安装cProfile?

msc*_*huh 8

通常它包含在Python的标准库中.您使用的是什么Python版本?您可以通过以下方式验证:

python -V
Run Code Online (Sandbox Code Playgroud)

您使用的是什么样的pip版本?您可以通过以下方式验证:

pip -V
Run Code Online (Sandbox Code Playgroud)

并升级它:

pip install -U pip
Run Code Online (Sandbox Code Playgroud)

当您尝试直接通过bash在包模式下运行cProfile时输出是什么,如:

python -m cProfile -o profile_output script.py
Run Code Online (Sandbox Code Playgroud)

此外,官方文档建议使用profileif cProfile在您的系统上不可用,因为它们大多可以互换.请参阅Python Profilers官方文档.

  • 你真的确定你没有搞砸案件吗?`cprofile` 和 `cProfile` 是 python 解释器的两个不同的东西。 (2认同)