How to write Python code that is able to properly require a minimal python version?

后端 未结 9 776
面向向阳花
面向向阳花 2021-01-31 01:33

I would like to see if there is any way of requiring a minimal python version.

I have several python modules that are requiring Python 2.6 due to the new exception handl

9条回答
  •  旧巷少年郎
    2021-01-31 02:16

    Rather than indexing you could always do this,

    import platform
    if platform.python_version() not in ('2.6.6'):
        raise RuntimeError('Not right version')
    

提交回复
热议问题