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

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

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

22条回答
  •  灰色年华
    2020-11-22 04:38

    A attempt using os.popen to read it in a variable:

    import os
    ver = os.popen('python -V').read().strip()
    print(ver)
    

提交回复
热议问题