"pip install line_profiler" 安装失败

10

我输入

sudo pip install "line_profiler"

我得到了

Downloading/unpacking line-profiler
  Could not find a version that satisfies the requirement line-profiler (from versions: 1.0b1, 1.0b2, 1.0b3)
Cleaning up...
No distributions matching the version for line-profiler
Storing debug log for failure in /home/milia/.pip/pip.log

当我使用以下命令搜索line_profile时:
sudo pip search "line_profiler"

I get:

django-debug-toolbar-line-profiler - A panel for django-debug-toolbar that integrates
                        information from line_profiler
line_profiler             - Line-by-line profiler.
tracerbullet              - A line-by-line profiler that doesn't suck.

一些情况下,下划线会被转换为“-”。我该如何规避这种情况?

pip安装line_profiler - Fabricator
与引号相同的结果。 - milia
2个回答

13

问题不在于 pip_ 转换为 - 以满足包命名要求,而问题是:该包处于 beta 状态,没有稳定的包版本。换句话说,在软件包 PyPI 页面上只有 beta 包版本链接可用。正如您所看到的,pip 已经注意到了这一点:

Could not find a version that satisfies the requirement line-profiler (from versions: 1.0b1, 1.0b2, 1.0b3)

根据Pre-release Versions文档页面:

从v1.4开始,默认情况下,pip仅安装符合PEP426规范的稳定版本。如果一个版本无法解析为符合PEP426版本,则被认为是预发布版。

pip install中传递--pre参数:

--pre

包括预发布版和开发版本。默认情况下,pip只查找稳定版本。

sudo pip install --pre line_profiler

或者,安装特定版本:

sudo pip install line_profiler==1.0b3

2
我安装了miniconda并运行了以下命令: $ conda install -c anaconda line_profiler 该命令会在anaconda的软件源中安装line_profiler。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接