Python pip package build instructions

Note on pip package cache

When building from source, there are some caches in the folder _skbuild. Remove it to redo a full build from scratch.

Use a specific version of OpenCV:

By default pip will fetch and build OpenCV (on windows, it will fetch a precompiled version). You can select a specific version by setting the environment variable OpenCV_DIR

Touristic note: 4 ways to set an env var with Windows

There are at least 4 incompatible ways to set an env var in Windows:

  • the clicky way

  • with PowerShell

    Set-Item -Path 'Env:OpenCV_DIR' -Value 'C:/your/path/to/opencv-4.6.0-vc14_vc15/opencv/build'
  • With bash:

    export OpenCV_DIR=C:/your/path/to/opencv-4.6.0-vc14_vc15/opencv/build
  • With dos:

    set OpenCV_DIR=C:/your/path/to/opencv-4.6.0-vc14_vc15/opencv/build

Build pip package from sources

cd path/to/your/project  # optional step, but recommended:
python -m venv venv      # create and activate a virtual env
.\venv\Script\activate

git clone https://github.com/pthom/imgui_bundle.git
cd imgui_bundle
pip install -v .          # install the library

Build and the library pip package from sources:

pip install -v .