Start by identifying your exact error message. The most common OpenCV errors on Windows are DLL load failures, PATH issues and import errors. Each has a specific fix.
DLL errors
DLL load failed errors (Python)
ImportError: DLL load failed while importing cv2: WinError 126
Missing Visual C++ Redistributable or corrupt OpenCV install
pip install opencv-python --force-reinstallopencv_iconv.dll — WinError 126: The specified module could not be found
VC++ Redistributable not installed or wrong Python architecture
Install vc_redist.x64.exe from microsoft.comDLL load failed: %1 is not a valid Win32 application
32-bit Python with 64-bit OpenCV (or vice versa)
Match Python and OpenCV architecture (both x64)Full fix steps: opencv_iconv.dll error guide
C++ DLL errors
DLL not found errors (C++)
opencv_world4120.dll was not found
OpenCV bin directory not in system PATH
Add C:\\opencv\\build\\x64\\vc16\\bin to PATHopencv_ocl246.dll — The specified module could not be found
OpenCL runtime missing or outdated GPU driver
Update GPU drivers or disable OpenCL in buildAVIF.dll — LNK1107: invalid or corrupt file
Linking wrong lib file (Debug vs Release mismatch)
Use opencv_world4120.lib (Release) or opencv_world4120d.lib (Debug)Full fix: opencv_world.dll not found guide
Import errors
Python import errors
ModuleNotFoundError: No module named 'cv2'
OpenCV not installed in the active Python environment
pip install opencv-pythonImportError: cannot import name 'cv2' from partially initialized module
Circular import or name conflict with a local file called cv2.py
Delete or rename any local file called cv2.pyFull fix: import cv2 error guide
Camera issues
VideoCapture and camera problems
cv2.VideoCapture(0) returns False / camera does not open
Wrong backend, camera index or permission
Try cv2.VideoCapture(0, cv2.CAP_DSHOW)Camera opens but frames are black or corrupted
DirectShow driver issue or wrong resolution
Set cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) explicitlyFull guide: VideoCapture issues guide
Quick diagnostics
Diagnose your OpenCV installation
# Check OpenCV version and build info:
import cv2
print(cv2.__version__)
print(cv2.getBuildInformation())
# Check which Python and pip are active:
C:\> python --version
C:\> where python
C:\> pip show opencv-python
FAQ
More troubleshooting questions
OpenCV installed but works in one Python and not another
You have multiple Python installations (Python 3.10, 3.11, Anaconda, etc.). OpenCV is only installed in one of them. Use
where python to see all Python installations. Install OpenCV in the correct one using python -m pip install opencv-python with the full path to the Python you want.After Windows update, OpenCV DLL errors appeared
Windows updates sometimes remove or replace Visual C++ Redistributables. Reinstall
vc_redist.x64.exe from microsoft.com and then pip install opencv-python --force-reinstall.cv2.imshow() crashes Python immediately
This usually means a Qt or OpenGL conflict. Try:
import os; os.environ["QT_QPA_PLATFORM"] = "windows" before importing cv2. Or use opencv-python-headless and save images with cv2.imwrite() instead.