Unable to install mediapipe via pip install mediapipe
resulting in mediapipe.solutions
attribute not found.
I'm running on Windows and trying to test a hand gesture using opencv and mediapipe but had trouble installing with pip install mediapipe
because it resulted in ERROR: No matching distribution found for mediapipe
so I install it via MSYS2. initially I put the repo on C:/Users/User/mediapipe
but when I tried calling import mediapipe
it results in ModuleNotFoundError: No module named 'mediapipe'
, so I tried putting the repo on the project file and somehow I can call mediapipe. the problem resides in when I call mediapipe.solutions
and results in AttributeError: module 'mediapipe' has no attribute 'solutions'
I searched it and the problem resides in library name on issue#1928 the solution is on the first problem I found which is to install it with pip, how do I fix this?
Running on Windows, pip 24.0, python 3.12
This is my code:
import cv2import mediapipe as mpimport pyautoguihandcap = mp.solutions.hands.Hands()drawings = mp.solutions.drawing_utlisdef testdevice(source): camera = cv2.VideoCapture(source) while True: _,image = camera.read() image = cv2.flip(image,1) rgb_img = cv2.cvtColor(image,cv2.COLOR_BGR2RGB) hand_output= handcap.process(rgb_img) allhand = hand_output.multi_hand_landmarks if allhand: for hands in allhand: drawings.draw_landmarks(image,hands) cv2.imshow("Hand Movement Video Capture",image) key = cv2.waitKey(100) if key == 27: break camera.release() cv2.destroyAllWindows()testdevice(0)testdevice(1)