Home > Net >  Python Error Traceback (most recent call last):
Python Error Traceback (most recent call last):

Time:12-06

I am trying the build a hand tracker in python.

there is my code

import cv2
from cvzone.HandTrackingModule import HandDetector

cap = cv2.VideoCapture(0)
detector = HandDetector(detectionCon=0.8, maxHands=1)

while True:
    success, img = cap.read()
    hands, img = detector.findHands(img, flipType=True)

    cv2.imshow("image", img)
    cv2.waitKey(1)

but I get this error

Traceback (most recent call last):
  File "C:/Users/haseb/PycharmProjects/Final2243/final.py", line 2, in <module>
    from cvzone.HandTrackingModule import HandDetector
  File "C:\Users\haseb\PycharmProjects\Final2243\venv\lib\site-packages\cvzone\HandTrackingModule.py", line 8, in <module>
    import mediapipe as mp
ModuleNotFoundError: No module named 'mediapipe'

CodePudding user response:

You should probably install mediapipe in your venv.

activate your venv, then try to install mediapipe :

pip install mediapipe

CodePudding user response:

the setup file setup.py in cvzone repo doesn't install the requirements , so you have to do it manually

download this requirements.txt file and do the following

cd [path]  
pip install - r requirements.txt
  • Related