[Python] Im having errors using mediapipe

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    So im using python 3.10 I Created the enviorement and installed CV2 and mediapipe there but when I try running the script it showed me the following error

    (Myenv) PS C:\Users\koala\OneDrive\Escritorio\IA> python mediapipe_video.py
    Traceback (most recent call last):
    File "C:\Users\koala\OneDrive\Escritorio\IA\mediapipe_video.py", line 2, in <module>
    import mediapipe as mp
    File "C:\Users\koala\OneDrive\Escritorio\IA\Myenv\lib\site-packages\mediapipe\__init__.py", line 15, in <module>
    from mediapipe.python import *
    File "C:\Users\koala\OneDrive\Escritorio\IA\Myenv\lib\site-packages\mediapipe\python\__init__.py", line 17, in <module>
    from mediapipe.python._framework_bindings import model_ckpt_util
    ImportError: DLL load failed while importing _framework_bindings: Error en una rutina de inicialización de biblioteca de vínculos dinámicos (DLL).


    I know the problem is not the code bc one friend of my has managed to run the same script

    import cv2
    import mediapipe as mp

    mp_drawing = mp.solutions.drawing_utils
    mp_hands = mp.solutions.hands

    cap = cv2.VideoCapture(0)

    with mp_hands.Hands(
    static_image_mode=False,
    max_num_hands=2,
    min_detection_confidence=0.5) as hands:
    while True:
    ret, frame = cap.read()
    if ret == False:
    break
    height, width, _ = frame.shape
    frame = cv2.flip(frame, 1)
    frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

    results = hands.process(frame_rgb)

    if results.multi_hand_landmarks is not None:
    for hand_landmarks in results.multi_hand_landmarks:
    mp_drawing.draw_landmarks(
    frame, hand_landmarks, mp_hands.HAND_CONNECTIONS,
    mp_drawing.DrawingSpec(color=(10,10,10), thickness=4, circle_radius=5),
    mp_drawing.DrawingSpec(color=(255,255,255), thickness=3, circle_radius=5))

    cv2.imshow('Frame',frame)
    if cv2.waitKey(1) & 0xFF == 27:
    break
    cap.release()

    cv2.destroyAllWindows()

    Continue reading...

Compartilhe esta Página