To get the path to the Python interpreter executable file in Blender, we need to check the “bpy.app.binary_path_python” variable.
However, in Blender 2.93 and later, this variable has been removed from the API, and in order to get the desired path to python executable, we need to refer to the “sys.executable”.
The best way for scripting is to define a function that returns the full path to the python executable for any version of Blender:
# 2.92 and older
path = bpy.app.binary_path_python
# 2.93 and later
path = sys.executable
And call it when we need:
# C:\Program Files\blender2-93\2.93\python\bin\python.EXE