Find full path of the Python interpreter?

前端 未结 3 1142
执念已碎
执念已碎 2020-11-22 15:40

How do I find the full path of the currently running Python interpreter from within the currently executing Python script?

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 16:36

    sys.executable contains full path of the currently running Python interpreter.

    import sys
    
    print(sys.executable)
    

    which is now documented here

提交回复
热议问题