def check_version(library, min_version):
"""Check minimum library version required
Parameters
----------
library : str
The library name to import. Must have a ``__version__`` property.
min_version : str
The minimum version string. Anything that matches
``'(\\d+ | [a-z]+ | \\.)'``
Returns
-------
ok : bool
True if the library exists with at least the specified version.
"""
ok = True
try:
library = __import__(library)
except ImportError:
ok = False
else:
this_version = LooseVersion(library.__version__)
if this_version < min_version:
ok = False
return ok
utils.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录