import sys import ensurepip import subprocess ensurepip.bootstrap() subprocess.call([sys.executable, '-m', 'pip', 'install', 'opencv-python']) import cv2 cv2.namedWindow('Test')