我正在使用 pip
需求文件 用于保存我的依赖项列表.
I'm using pip
requirements files for keeping my dependency list.
我还尝试遵循管理依赖项的最佳实践,并在需求文件中提供精确的包版本.例如:
I also try to follow best practices for managing dependencies and provide precise package versions inside the requirements file. For example:
Django==1.5.1
lxml==3.0
问题是:有没有办法告诉 Python 包索引中是否有任何更新的包版本可用于 requirements.txt
中列出的包?
The question is: Is there a way to tell that there are any newer package versions available in the Python Package Index for packages listed inside requirements.txt
?
对于这个特定的示例,当前最新的可用版本分别是 Django 和 lxml 的 1.6.2 和 3.3.4.
For this particular example, currently latest available versions are 1.6.2 and 3.3.4 for Django and lxml respectively.
我试过 pip install --upgrade -r requirements.txt
,但它说一切都是最新的:
I've tried pip install --upgrade -r requirements.txt
, but it says that all is up-to-date:
$ pip install --upgrade -r requirements.txt
Requirement already up-to-date: Django==1.5.1 ...
请注意,此时我不想运行实际升级 - 我只想看看是否有可用的更新.
Note that at this point I don't want to run an actual upgrade - I just want to see if there are any updates available.
Pip 内置了这个功能.假设你在你的 virtualenv 类型中:
Pip has this functionality built-in. Assuming that you're inside your virtualenv type:
$ pip list --outdated
psycopg2 (Current: 2.5.1 Latest: 2.5.2)
requests (Current: 2.2.0 Latest: 2.2.1)
$ pip install -U psycopg2 requests
之后,将下载并安装新版本的 psycopg2 和请求.那么:
After that new versions of psycopg2 and requests will be downloaded and installed. Then:
$ pip freeze > requirements.txt
你就完成了.这不是一个命令,但优点是您不需要任何外部依赖项.
And you are done. This is not one command but the advantage is that you don't need any external dependencies.
这篇关于检查要求是否是最新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!