The Python used to run lit can be different from the Python LLDB was build with. One scenario where this happens is when LLVM can find the Python 3 interpreter, but not the Python 3 libraries, in which case LLDB build and links against Python 3. Without this change, you end up with an ModuleNotFoundError because of the mismatch.
Instead of looking at the Python interpreter that's used to run lit, we should use the interpreter that matches the Python version LLDB was build against.