01
Setup & import
$ pip install opencv-python— the main build: core + GUI (imshow).$ pip install opencv-contrib-python— adds extra/patented modules (SIFT lives in core now, but tracking, aruco, etc. are here).$ pip install opencv-python-headless— no GUI; for servers / Docker / notebooks.import cv2— the import name is cv2, not opencv.import numpy as np— you'll need it; images are numpy arrays.cv2.__version__— check the build;'4.13.0'here. Latest 4.x is'4.14.x';opencv-python==5.0.0.xinstalls OpenCV 5.0.- OpenCV 5.0 (Jul 2026): the legacy C API is gone (C++17 core), and the
mlmodule +G-APImoved toopencv-contrib-python— the Python cv2 surface below is otherwise unchanged. - Pick one of the three packages — installing several fights over the same
cv2namespace.