python 3.9 install pip cv2
snippet in c

windows python install opencv


pip install opencv-python

cv2 install pip


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: