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

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

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

22条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 04:50

    import sys
    sys.version.split(' ')[0]
    

    sys.version gives you what you want, just pick the first number :)

提交回复
热议问题