Python 和 pip,列出可用包的所有版本? [英] Python and pip, list all versions of a package that's available?

查看:63
本文介绍了Python 和 pip,列出可用包的所有版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定一个可以用 pip 安装的 Python 包的名称,是否有任何如何找出 pip 可以安装的所有可能版本的列表?现在是反复试验.

Given the name of a Python package that can be installed with pip, is there any way to find out a list of all the possible versions of it that pip could install? Right now it's trial and error.

我正在尝试为第三方库安装一个版本,但最新版本太新,进行了向后不兼容的更改.所以我想以某种方式列出 pip 知道的所有版本,以便我可以测试它们.

I'm trying to install a version for a third party library, but the newest version is too new, there were backwards incompatible changes made. So I'd like to somehow have a list of all the versions that pip knows about, so that I can test them.

推荐答案

(更新:截至 2020 年 3 月,很多人反馈 yolk,通过 pip install yolk3k 安装,只返回最新版本.克里斯的回答似乎获得了最多的赞成票并且对我有用)

(update: As of March 2020, many people have reported that yolk, installed via pip install yolk3k, only returns latest version. Chris's answer seems to have the most upvotes and worked for me)

pastebin 中的脚本确实有效.但是,如果您使用多个环境/主机,这不是很方便,因为您每次都必须复制/创建它.

The script at pastebin does work. However it's not very convenient if you're working with multiple environments/hosts because you will have to copy/create it every time.

更好的全方位解决方案是使用 yolk3k,它可以与点.例如.查看可用的 Django 版本:

A better all-around solution would be to use yolk3k, which is available to install with pip. E.g. to see what versions of Django are available:

$ pip install yolk3k
$ yolk -V django
Django 1.3
Django 1.2.5
Django 1.2.4
Django 1.2.3
Django 1.2.2
Django 1.2.1
Django 1.2
Django 1.1.4
Django 1.1.3
Django 1.1.2
Django 1.0.4

yolk3k 是原始 yolk2012 中停止开发.尽管 yolk 不再维护(如下面的注释所示),yolk3k 似乎支持 Python 3.

yolk3k is a fork of the original yolk which ceased development in 2012. Though yolk is no longer maintained (as indicated in comments below), yolk3k appears to be and supports Python 3.

注意:我不参与 yolk3k 的开发.如果某些东西似乎不能正常工作,在这里发表评论应该没有太大区别. 使用 yolk3k 问题跟踪器 并考虑在可能的情况下提交修复程序.

Note: I am not involved in the development of yolk3k. If something doesn't seem to work as it should, leaving a comment here should not make much difference. Use the yolk3k issue tracker instead and consider submitting a fix, if possible.

这篇关于Python 和 pip,列出可用包的所有版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆