diff --git a/tools/msvs/find_python.cmd b/tools/msvs/find_python.cmd index 8554d026cd4e3b..06e41fe06cd6ab 100644 --- a/tools/msvs/find_python.cmd +++ b/tools/msvs/find_python.cmd @@ -46,6 +46,8 @@ exit /b 1 :found-python echo Python found in %p%\python.exe +call :check-python %p%\python.exe +if errorlevel 1 goto :no-python endlocal ^ & set "pt=%p%" ^ & set "need_path_ext=%need_path%" @@ -54,6 +56,15 @@ set "pt=" set "need_path_ext=" exit /b 0 +:check-python +%~1 -V +:: 9009 means error file not found +if %errorlevel% equ 9009 ( + echo Not an executable Python program + exit /b 1 +) +exit /b 0 + :no-python echo Could not find Python. exit /b 1