diff --git a/CMakeLists.txt b/CMakeLists.txt index 415f32155990..bafcea96e96b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -979,9 +979,11 @@ if(IREE_BUILD_PYTHON_BINDINGS) set(_PYTHONPATH_ENV "PYTHONPATH=$\n") file(GENERATE OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/.env" CONTENT "${_PYTHONPATH_ENV}") file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/.env" CONTENT "${_PYTHONPATH_ENV}") - # Similarly, write out .env.bat for Windows. + # Similarly, write out .env.bat and .env.ps1 for Windows. set(_PYTHONPATH_ENV_BAT "set PYTHONPATH=$\n") file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/.env.bat" CONTENT "${_PYTHONPATH_ENV_BAT}") + set(_PYTHONPATH_ENV_PS1 "$env:PYTHONPATH = '$'\n") + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/.env.ps1" CONTENT "${_PYTHONPATH_ENV_PS1}") endif() if(IREE_BUILD_BINDINGS_TFLITE) diff --git a/docs/website/docs/building-from-source/getting-started.md b/docs/website/docs/building-from-source/getting-started.md index 8ed175d03a22..978ee10ab5cc 100644 --- a/docs/website/docs/building-from-source/getting-started.md +++ b/docs/website/docs/building-from-source/getting-started.md @@ -360,24 +360,33 @@ Extend your `PYTHONPATH` with IREE's `bindings/python` paths and try importing: ``` shell source ../iree-build/.env && export PYTHONPATH - python -c "import iree.compiler" - python -c "import iree.runtime" + # The 'PYTHONPATH' environment variable should now contain + # iree-build/compiler/bindings/python;iree-build/runtime/bindings/python + + python -c "import iree.compiler; help(iree.compiler)" + python -c "import iree.runtime; help(iree.runtime)" ``` === ":fontawesome-brands-apple: macOS" ``` shell source ../iree-build/.env && export PYTHONPATH - python -c "import iree.compiler" - python -c "import iree.runtime" + # The 'PYTHONPATH' environment variable should now contain + # iree-build/compiler/bindings/python;iree-build/runtime/bindings/python + + python -c "import iree.compiler; help(iree.compiler)" + python -c "import iree.runtime; help(iree.runtime)" ``` === ":fontawesome-brands-windows: Windows" ``` powershell - ../iree-build/.env.bat - python -c "import iree.compiler" - python -c "import iree.runtime" + ..\iree-build\.env.ps1 # or ..\iree-build\.env.bat + # The 'PYTHONPATH' environment variable should now contain + # iree-build/compiler/bindings/python;iree-build/runtime/bindings/python + + python -c "import iree.compiler; help(iree.compiler)" + python -c "import iree.runtime; help(iree.runtime)" ``` Using IREE's ML framework importers requires a few extra steps: