Reputation: 33
im trying to run this
import cv2
import numpy as np
import os
from matplotlib import plypot as plt
import time
import mediapipe as mp
and also
cap = cv2.VideoCapture(0)
while cap.isOpened():
#Reads feed
ret, frame = cap.read()
cv2.inshow('OpenCV feed', frame)
#breaks for a while
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
in vscode the first one gives me ModuleNotFoundError: No module named 'cv2' and the second code gives me NameError: name 'cv2' is not defined.
here is a picture of my opencv requirements
i tried pip install opencv-python
but all the requirement were met
Upvotes: 1
Views: 1739
Reputation: 92
Try using pip3 install opencv-python
, as it installs opencv for python3, not python2 (if you have it installed). If you only have python3, pip and pip3 are basically the same thing (I think).
Upvotes: 1