Get LooseVersion () and .__ version__ use version numbers

I simply looked distutils library, but found that there is less than, feeling a bit complicated. So I simply copied the introduction of others, as follows:

Distutils can be used to build and install additional modules Python environment. The new module can be a pure Python can also be used C / C ++ to write extension modules,

Or may be a Python package, the package contains modules written in C and Python.

For this reason, I do not understand, I will only function I encounter do a presentation, its code is as follows:

skimage Import 
from distutils.version Import LooseVersion
A # = skimage .__ version__ obtained skimage version
print (a) # Print out version skimage
c = LooseVersion ( "0.14") # comparing a version number of the function
Print (C)
D = LooseVersion ( .__ version__ skimage)> = LooseVersion ( "0.14")
# judging system installation skimage version is greater than the 0.14 version of skimage, if it returns True, otherwise False
Print (d)

where 0.16.2 is my environment installed skimage version number, and 0.14 version comparison, if the environment is to install skimage version than
version 0.14, the result returned is True, the results are as follows:

Guess you like

Origin www.cnblogs.com/tangjunjun/p/12043740.html