How do I check what version of Python is running my script?

前端 未结 22 2083
醉话见心
醉话见心 2020-11-22 04:11

How can I check what version of the Python Interpreter is interpreting my script?

22条回答
  •  失恋的感觉
    2020-11-22 04:34

    I like sys.hexversion for stuff like this.

    http://docs.python.org/library/sys.html#sys.hexversion

    >>> import sys
    >>> sys.hexversion
    33883376
    >>> '%x' % sys.hexversion
    '20504f0'
    >>> sys.hexversion < 0x02060000
    True
    

提交回复
热议问题