Install guide

OpenCV Windows install methods — pip vs conda vs source vs vcpkg

Four ways to install OpenCV on Windows compared: pip (easiest), conda (Anaconda users), build from source (CUDA support) and vcpkg (C++ Visual Studio).

For most Python users, pip install opencv-python is the right choice. Only use other methods if you have a specific reason.

OpenCV install methods compared

MethodEaseCUDA supportContrib modulesBest for
pipEasiestNoYes (contrib pkg)Most Python users
condaEasyNoYesAnaconda users
Build from sourceHardYesYesCUDA, custom builds
vcpkgMediumOptionalYesC++ / Visual Studio
Pre-built exeEasyNoLimitedC++ without building

pip (PyPI wheels)

The simplest and most common installation method. Pre-compiled wheels for Windows x64 are available for Python 3.7–3.13.

cmd.exe
C:\> pip install opencv-python
# Or with extra modules:
C:\> pip install opencv-contrib-python

Pros: one command, no compilation, updates easily. Cons: no CUDA, no custom build options.

conda (Anaconda / Miniconda)

Good choice if you already use Anaconda. The conda-forge channel has well-maintained builds.

Anaconda Prompt
(base)> conda install -c conda-forge opencv

Pros: integrates with conda environments, handles native library dependencies well. Cons: no CUDA, slightly older builds than pip.

Build from source (CMake)

Required for CUDA GPU acceleration or custom feature sets. Takes 30–90 minutes to compile.

PowerShell
PS> git clone https://github.com/opencv/opencv.git
PS> cmake -B build -DWITH_CUDA=ON -DCUDA_ARCH_BIN="8.6"
PS> cmake --build build --config Release --parallel 8

Full guide: CMake build guide. For CUDA: CUDA guide.

Pros: full control, CUDA support, latest features. Cons: complex, slow to compile, requires Visual Studio.

vcpkg (C++ package manager)

Microsoft's C++ package manager. Good integration with Visual Studio.

PowerShell
# Install vcpkg first if needed:
PS> git clone https://github.com/microsoft/vcpkg.git
PS> .\vcpkg\bootstrap-vcpkg.bat
# Install OpenCV:
PS> .\vcpkg\vcpkg.exe install opencv4[contrib]:x64-windows
# Integrate with Visual Studio:
PS> .\vcpkg\vcpkg.exe integrate install

Pros: seamless Visual Studio integration, contrib modules included. Cons: large download, no CUDA by default.

Install method questions

Can I mix pip and conda OpenCV?
No. Never install both opencv-python (pip) and opencv (conda) in the same environment. They will conflict and cause import errors. Stick to one package manager per environment.
Is there a pre-built CUDA wheel for pip?
Not officially. Some third-party wheels exist on GitHub (search "opencv-python cuda wheel") but they are unofficial and may not match your CUDA/cuDNN version. For production CUDA use, build from source.
Which method should I use for a web server / Docker?
Use pip install opencv-python-headless. The headless package excludes GUI dependencies (Qt) which are not needed on a server and can cause errors in headless environments. See Headless guide.

Using Anaconda?

Full conda setup guide with environment creation.

Conda guide