Specifying OpenCV as Python package prereq

An easy way to install OpenCV in Python is simply:

pip install opencv-python

This carries over into your setup.cfg file, simply include:

opencv =

This allows users to retain their existing OpenCV install, which may be customized / optimized, while giving an easy path for new OpenCV users. You can tell users that if they don’t already have OpenCV, try:

pip install .[opencv]


This is also a good technique for continuous integration systems like Travis-CI, in the .travis.yml file include:

- pip install .[tests,cov,opencv]

just takes a few seconds.

Install OpenCV in Python