[BE][Ez]: Use sys.executable instead of hardcoded Python (#165679)

Handles edgecase to ensure proper interpreter is called. Inspired by #165633
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165679
Approved by: https://github.com/FindHao
This commit is contained in:
Aaron Gokaslan
2025-10-17 01:07:36 +00:00
committed by PyTorch MergeBot
parent d82527b32a
commit 9726553653

View File

@ -3,6 +3,7 @@ import argparse
import os
import re
import subprocess
import sys
from pathlib import Path
@ -107,7 +108,7 @@ def process_file(
env["TORCHINDUCTOR_DUMP_LAUNCH_PARAMS"] = "1"
result = subprocess.run(
["python", input_filename],
[sys.executable, input_filename],
env=env,
capture_output=True,
text=True,