[Fix] Use sys.executable instead of hardcoded python (#165633)

Replace hardcoded "python" string with sys.executable to ensure correct Python interpreter is used. This fixes failures on systems with multiple Python runtimes or where "python" is not in PATH.

Similar to pytorch/pytorch#155918

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165633
Approved by: https://github.com/Skylion007
This commit is contained in:
linhaifeng 2025-10-16 20:26:06 +00:00 committed by PyTorch MergeBot
parent 585b9dbb5e
commit 37f3ba274a

View File

@ -640,7 +640,7 @@ class _ValgrindWrapper:
stat_log=stat_log, stat_log=stat_log,
bindings=self._bindings_module)) bindings=self._bindings_module))
run_loop_cmd = ["python", script_file] run_loop_cmd = [sys.executable, script_file]
else: else:
if collect_baseline: if collect_baseline:
raise AssertionError("collect_baseline must be False for non-Python timers") raise AssertionError("collect_baseline must be False for non-Python timers")