浏览代码

pyenv-win compatibility - another approach (#16287)

viking1304 9 月之前
父节点
当前提交
f31faf6f14
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      webui.bat

+ 10 - 1
webui.bat

@@ -4,7 +4,16 @@ if exist webui.settings.bat (
     call webui.settings.bat
     call webui.settings.bat
 )
 )
 
 
-if not defined PYTHON (set PYTHON=python)
+if not defined PYTHON (
+  for /f "delims=" %%A in ('where python ^| findstr /n . ^| findstr ^^1:') do (
+    if /i "%%~xA" == ".exe" (
+      set PYTHON=python
+    ) else (
+      set PYTHON=call python
+    )
+  )
+)
+
 if defined GIT (set "GIT_PYTHON_GIT_EXECUTABLE=%GIT%")
 if defined GIT (set "GIT_PYTHON_GIT_EXECUTABLE=%GIT%")
 if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
 if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")