pip opencv

pip-opencv

This script allow us to install only one of the four available opencv-python packages via pip-tools.

Arguments:
  • $1… - The path to the requirements.txt to be inline patched

OpenCV provides four interchangable python packages: - opencv-contrib-python: main modules, contrib/extra, GUI - opencv-python: main modules, GUI - opencv-contrib-python-headless: main modules, contrib/extra, headless (no GUI) - opencv-python-headless: main modules, headless (no GUI)

Users are advised to install only one of the four packages opencv-python depending on their needs https://pypi.org/project/opencv-python/#:~:text=There%20are%20four,only%20one%20package

This function will modify a pip-tools requirements.txt file to keep only one opencv python package. By default, this will be the most fully featured opencv python package. Other opencv python packages are commented out from the requirements.txt file.

A subsequent pip-sync must be run with the argument --pip-args --no-deps to ensure only one opencv-python package is installed.

Arguments:
  • $1 - requirements.txt file to be modified

  • [$2] - optional opencv python package to keep, defaults to most fully featured package

pip-opencv

Same syntax as pip-opencv