python 3.9 install pip cv2
snippet in c

windows python install opencv

user600

pip install opencv-python

cv2 install pip

user3380

A quick clarification on the other answers, opencv-contrib-python 
and opencv-python are unofficial pre-built wheels. Install one or 
the other. opencv-contrib-python has a bit more features. 
The official installation instructions are on the opencv website.
More info can be found here: 
https://www.pyimagesearch.com/opencv-tutorials-resources-guides/