How to install opencv-python 4.5.1-dev in Mac?

I was using “pip install opencv-contrib-python” to install the packages which contain both main modules and contrib/extra modules. However, the installed version is 4.5.1. How could I install 4.5.1-dev? Thanks!

Hi,
That’s not possible with pip.
If you need a dev version you have to buiild is using cmake

you don’t need a “dev” version.

OpenCV has releases. those are good for everything.

“dev version” means git master HEAD, and you don’t need that unless you actually work on OpenCV itself.

You can do that by compiling the development version manually. This can be done by following the manual build instructions at opencv-python documentation: GitHub - opencv/opencv-python: Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages.

Short summary:

Make sure you have build tools installed and you have the latest version of pip.

  1. Clone the repository: git clone --recursive https://github.com/opencv/opencv-python.git
  2. cd opencv-python
  3. cd opencvgit pull → checkout the latest development commit → cd ..
  4. cd opencv_contribgit pull → checkout the latest development commit → cd ..
  5. export ENABLE_CONTRIB=1
  6. Run pip wheel . --verbose (this will take over 5 minutes, usually 10+)
  7. Wheel package will be generated to dist-directory
  8. Install the custom package from the dist-directory with pip install package_name.whl
1 Like