如何比较Debian软件包的版本? [英] How to compare Debian package versions?
本文介绍了如何比较Debian软件包的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我查看了python-apt
和python-debian
,它们似乎没有比较软件包版本的功能.我需要自己编写,还是可以使用?
I looked at python-apt
and python-debian
, and they don't seem to have functionality to compare package versions. Do I have to write my own, or is there something I can use?
理想情况下,它看起来像:
Ideally, it would look something like:
>>> v1 = apt.version("1:1.3.10-0.3")
>>> v2 = apt.version("1.3.4-1")
>>> v1 > v2
True
推荐答案
您可以使用收益
version a > version b
感谢Tshepang在评论中指出
对于较新的版本:apt.VersionCompare
现在为
Thanks to Tshepang for noting in the comments that
for newer versions: apt.VersionCompare
is now apt_pkg.version_compare
.
这篇关于如何比较Debian软件包的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文