import cv2 count = cv2.cuda.getCudaEnabledDeviceCount() print(count)