1 Star 2 Fork 2

kentzhang / python-sdk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
py_vesion_checker.py 728 Bytes
一键复制 编辑 原始数据 按行查看 历史
kentzhang 提交于 2021-03-10 23:14 . add file
import platform
py_version_min = 3.6
py_version_max = 4.0
def compare_py_version():
ver_tuple = platform.python_version_tuple()
floatver = float(ver_tuple[0]) + float(ver_tuple[1]) / 10
if floatver < py_version_min:
return -1
if floatver > py_version_max:
return 1
return 0
def check_py_version_with_exception():
res = compare_py_version()
desc = ""
if res < 0:
desc = "version {} lower than {}".format(platform.python_version(), py_version_min)
raise Exception(desc)
if res > 0:
desc = "version {} higher than {}".format(platform.python_version(), py_version_max)
raise Exception(desc)
return True
# check_py_version_with_exception()
1
https://gitee.com/coderkent/python-sdk.git
git@gitee.com:coderkent/python-sdk.git
coderkent
python-sdk
python-sdk
master

搜索帮助