require_version¶
- paddle.utils. require_version ( min_version, max_version=None ) [source]
-
Check if the installed version of PaddlePaddle is in [min_version, max_version], if the installed version is lower than
min_version
or higher thanmax_version
, an exception will be thrown, NO returns if the installed version is satisfied.- Parameters
-
min_version (str) – the minimum version required (like ‘1.4.0’).
max_version (str, optional) – the max version required (like ‘1.6.0’), default is None, meaning any version equal or higher than
min_version
is acceptable.
- Returns
-
None.
- Raises
-
TypeError – if the type of
min_version
is not str.TypeError – if the type of
max_version
is not str or type(None).ValueError – if the value of
min_version
is not in version format.ValueError – if the value of
max_version
is not in version format or None.Exception – if the installed version is lower than
min_version
or higher thanmax_version
.
Examples
>>> import paddle >>> # any version >= 0.1.0 is acceptable. >>> paddle.utils.require_version('0.1.0') >>> # if 0.1.0 <= version <= 10.0.0, it is acceptable. >>> paddle.utils.require_version(min_version='0.1.0', max_version='10.0.0')