How to Install opencv-python in Python
Wrapper package for OpenCV python bindings.
pip install opencv-python
What is opencv-python?
Wrapper package for OpenCV python bindings.
OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. Donate to OpenCV on Github to show your support.
- OpenCV on Wheels - Installation and Usage - Frequently Asked Questions - Documentation for opencv-python - CI build process - Manual builds - Manual debug builds - Source distributions - Licensing - Versioning - Releases - Development builds - Manylinux wheels - Supported Python versions - Backward compatibility
Pre-built CPU-only OpenCV packages for Python.
Quick Start
Minimal example to get started with opencv-python:
import cv2
print(cv2.__version__)
Installation
pip (standard)
pip install opencv-python
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install opencv-python
pip3
pip3 install opencv-python
conda
conda install -c conda-forge opencv-python
Poetry
poetry add opencv-python
Dependencies
Installing opencv-python will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import cv2; print(cv2.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing opencv-python with pip.
ModuleNotFoundError: No module named 'cv2'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install opencv-python. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'cv2' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install opencv-python to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'cv2'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show opencv-python and upgrade with pip install --upgrade opencv-python.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install opencv-python. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user opencv-python
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org opencv-python
MemoryError when loading data
Cause: Dataset is too large to fit in RAM.
Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.
Recent Releases
| Version | Released |
|---|---|
4.13.0.92 latest |
2026-02-05 |
4.13.0.90 |
2026-01-18 |
4.12.0.88 |
2025-07-07 |
4.11.0.86 |
2025-01-16 |
4.10.0.84 |
2024-06-17 |
Manage opencv-python
Upgrade to latest version
pip install --upgrade opencv-python
Install a specific version
pip install opencv-python==4.13.0.92
Uninstall
pip uninstall opencv-python
Check what is installed
pip show opencv-python