简体   繁体   English

Python 错误回溯(最后一次调用):

[英]Python Error Traceback (most recent call last):

I am trying the build a hand tracker in python.我正在尝试在 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'

You should probably install mediapipe in your venv.您可能应该在您的 venv 中安装 mediapipe。

activate your venv, then try to install mediapipe:激活您的 venv,然后尝试安装 mediapipe:

pip install mediapipe pip 安装媒体管道

the setup file setup.py in cvzone repo doesn't install the requirements, so you have to do it manually cvzone repo 中的设置文件setup.py没有安装要求,所以你必须手动完成

download this requirements.txt file and do the following下载此requirements.txt文件并执行以下操作

cd [path]  
pip install - r requirements.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM