Reputation: 81
I'm trying to import apt
in python3 so I can use its VersionCompare()
method. I keep getting 'module not found'
types of errors. I'm using a mac. I tried brew install python-apt
to no avail. Is there a version of apt
in python3 or is there another way to compare versions that's simple?
I need to compare versions that are alpha-numeric, not pure integers.
Upvotes: 0
Views: 85
Reputation: 30258
You can use parse_version
from pkg_resources
which is part of setuptools
which I presume you have installed:
>>> from pkg_resources import parse_version
>>> parse_version('2.0a') > parse_version('1.0-a0-dev')
True
>>> parse_version('2.0a') > parse_version('2.0-b-dev')
False
Upvotes: 1