FAQ

OpenCV Windows FAQ — all common questions answered

Quick answers to the most common OpenCV questions on Windows: pip install, DLL errors, import errors, camera issues, C++ setup and version management.

Install & packages

What is the easiest way to install OpenCV on Windows?
pip install opencv-python — one command, no compilation needed. Verify with python -c "import cv2; print(cv2.__version__)". See Python install guide.
opencv-python vs opencv-contrib-python vs opencv-python-headless?
opencv-python: main modules + GUI. opencv-contrib-python: main + extra modules (SIFT, face recognition). opencv-python-headless: no GUI, for servers. Never install more than one at the same time.
Is OpenCV free to use commercially?
Yes. OpenCV is released under the Apache 2.0 license which permits free personal and commercial use. Some older contrib algorithms (SIFT) had patents that have now expired.
Which Python version works with OpenCV 4.12?
Python 3.7 through 3.13 on Windows 64-bit. Python 3.10 or 3.11 is recommended for best ecosystem compatibility.

DLL & import errors

DLL load failed while importing cv2: WinError 126
Install Visual C++ Redistributable from microsoft.com, then pip install opencv-python --force-reinstall. Full fix at opencv_iconv.dll fix guide.
ModuleNotFoundError: No module named 'cv2'
OpenCV is not installed in your active Python environment. Run pip install opencv-python. If it still fails, check where python — you may have multiple Python installations. See import cv2 error guide.
opencv_world4120.dll was not found
Add C:\opencv\build\x64\vc16\bin to your system PATH and restart your app. Or copy the DLL next to your .exe. See opencv_world.dll fix guide.
Works in terminal but not in VS Code / PyCharm
Your IDE uses a different Python interpreter. In VS Code: Ctrl+Shift+P → Python: Select Interpreter. In PyCharm: File → Settings → Python Interpreter.

Camera & video

cv2.VideoCapture(0) returns False
Try the DirectShow backend: cv2.VideoCapture(0, cv2.CAP_DSHOW). Also check Windows camera privacy settings. See VideoCapture fix guide.
cv2.imshow() window closes immediately
Add cv2.waitKey(0) after imshow(). Without it the window is destroyed instantly. Use cv2.waitKey(1) in a loop for live video.

C++ & build

How to configure OpenCV in Visual Studio?
Add include directory, lib directory and opencv_world4120.lib to Additional Dependencies. Add bin to PATH for DLL. See C++ / Visual Studio guide.
How to build OpenCV with CUDA on Windows?
Install Visual Studio, CMake, CUDA Toolkit and cuDNN. Clone OpenCV source. Run cmake with -DWITH_CUDA=ON -DCUDA_ARCH_BIN=8.6. See CUDA guide.
pip install vs build from source — which to choose?
Use pip for Python. Build from source only if you need CUDA, custom modules or the very latest git version. See Install methods comparison.

Version & update

What is the latest OpenCV version?
OpenCV 4.12.0 (May 2026). Update with pip install --upgrade opencv-python. Check current version: python -c "import cv2; print(cv2.__version__)".
How to downgrade to an older OpenCV version?
pip install opencv-python==4.9.0.80. List all available versions: pip index versions opencv-python.

Ready to install?

Get OpenCV running on Windows in 60 seconds.

Python install guide