You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 regels
1.1 KiB

  1. @echo off
  2. setlocal
  3. chcp 65001 >nul
  4. title PLSR Python Upper Computer
  5. cd /d "%~dp0"
  6. set "PYTHONUTF8=1"
  7. set "PYTHONIOENCODING=utf-8"
  8. set "PYTHON_EXE=%USERPROFILE%\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"
  9. set "PYTHON_ARGS="
  10. if exist "%PYTHON_EXE%" goto python_found
  11. where py >nul 2>nul
  12. if not errorlevel 1 (
  13. set "PYTHON_EXE=py"
  14. set "PYTHON_ARGS=-3"
  15. goto python_found
  16. )
  17. where python >nul 2>nul
  18. if not errorlevel 1 (
  19. set "PYTHON_EXE=python"
  20. goto python_found
  21. )
  22. echo No usable Python runtime was found.
  23. echo Install Python 3.9 or later, then run this file again.
  24. pause
  25. exit /b 1
  26. :python_found
  27. "%PYTHON_EXE%" %PYTHON_ARGS% -c "import serial" >nul 2>nul
  28. if errorlevel 1 (
  29. echo Installing pyserial...
  30. "%PYTHON_EXE%" %PYTHON_ARGS% -m pip install -r requirements.txt
  31. if errorlevel 1 (
  32. echo Failed to install pyserial.
  33. pause
  34. exit /b 1
  35. )
  36. )
  37. "%PYTHON_EXE%" %PYTHON_ARGS% plsr_gui.py
  38. set "PLSR_EXIT=%ERRORLEVEL%"
  39. if not "%PLSR_EXIT%"=="0" (
  40. echo.
  41. echo PLSR GUI exited with code %PLSR_EXIT%.
  42. pause
  43. )
  44. exit /b %PLSR_EXIT%