"pip install line_profiler"失败

mil*_*lia 9 python pip

我打字

sudo pip install "line_profiler"
Run Code Online (Sandbox Code Playgroud)

我明白了

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
Run Code Online (Sandbox Code Playgroud)

当我使用搜索line_profile时

sudo pip search "line_profiler"
Run Code Online (Sandbox Code Playgroud)

我明白了:

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.
Run Code Online (Sandbox Code Playgroud)

不知何故,下划线变为" - ".我怎么能绕过那个?

ale*_*cxe 12

问题不在于pip转换_-满足包命名要求的事实,但问题是:包处于beta状态,没有稳定的包版本.换句话说,包PyPI页面beta上只有包版本链接.如你所见,看到它:pip

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

根据预发布版本文档页面:

从v1.4开始,pip 默认只安装PEP426指定的稳定版本.如果版本无法解析为兼容的 PEP426版本,则假定它是预发布版本.

--pre参数传递给pip install:

- 事先

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

sudo pip install --pre line_profiler
Run Code Online (Sandbox Code Playgroud)

或者,安装特定版本:

sudo pip install line_profiler==1.0b3
Run Code Online (Sandbox Code Playgroud)