get_python_path.bat 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. @echo off
  2. REM
  3. REM Copyright (c) Contributors to the Open 3D Engine Project.
  4. REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. REM
  6. REM SPDX-License-Identifier: Apache-2.0 OR MIT
  7. REM
  8. REM
  9. :: Retreives the path to the O3DE python executable(s)
  10. :: Skip initialization if already completed
  11. IF "%O3DE_PYTHONHOME_INIT%"=="1" GOTO :END_OF_FILE
  12. SET CMD_DIR=%~dp0
  13. :: Note, many DCC tools (like Maya) include thier own versioned python interpretter.
  14. :: Some apps may not operate correctly if PYTHONHOME is set/propogated.
  15. :: This is definitely the case with Maya, doing so causes Maya to not boot.
  16. FOR /F "tokens=* USEBACKQ" %%F IN (`%CMD_DIR%\python.cmd %CMD_DIR%\get_python_path.py`) DO (SET O3DE_PYTHONHOME=%%F)
  17. echo O3DE_PYTHONHOME - is now the folder containing O3DE python executable
  18. echo O3DE_PYTHONHOME = %O3DE_PYTHONHOME%
  19. SET PYTHON=%O3DE_PYTHONHOME%\python.exe
  20. :: Set flag so we don't initialize dccsi environment twice
  21. SET O3DE_PYTHONHOME_INIT=1
  22. GOTO END_OF_FILE
  23. :: Return to starting directory
  24. POPD
  25. :END_OF_FILE