Install OpenCV with python

less than 1 minute read

Published:

An example of installing openCV with python3.

#!/bin/bash

# cmake command for openCV Installation

PY3V="3.6"
PYTHON3DIR="/usr/local/Cellar/python3/${PY3V}.3/Frameworks/Python.framework/Versions"

cmake -DCMAKE_BUILD_TYPE=Release -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -DPYTHON3_PACKAGES_PATH=${PYTHON3DIR}/${PY3V}/lib/python${PY3V}/site-packages -DPYTHON3_LIBRARY=${PYTHON3DIR}/${PY3V}/lib/libpython${PY3V}m.dylib -DPYTHON3_INCLUDE_DIR=${PYTHON3DIR}/${PY3V}/include/python${PY3V}m ..