Ok, so. I know how to make an .exe from .py, but when mediapipe module is present in the code, the .exe will give me this error. It says "The path does not exist.", but it does. Here is the path code, and Here is the path itself. Here is how to replicate this error: 1.copy my main.py 2.pip instal cv2, mediapipe and pyinstaller 3.run pyinstaller 4.copy mediapipe files to the same folder as main.exe 5.run main.exe Please help me, I have been trying to fix this for 8 hours straight and i just can't keep going. Any help is welcome. Thank you all in advance!
main.py:
import cv2
import mediapipe as mp
cap = cv2.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
mpDraw = mp.solutions.drawing_utils
while True:
success, img = cap.read()
img = cv2.flip(img, 1)
imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
results = hands.process(imgRGB)
if results.multi_hand_landmarks:
for handLms in results.multi_hand_landmarks:
mpDraw.draw_landmarks(img, handLms, mpHands.HAND_CONNECTIONS)
for id, lm in enumerate(handLms.landmark):
h, w, c = img.shape
cx, cy = int(lm.x * w), int(lm.y * h)
cv2.circle(img, (cx, cy), 7, (255, 0, 255), cv2.FILLED)
cv2.putText(img, str(id), (cx+10,cy+10), cv2.FONT_HERSHEY_PLAIN, 1.0, (0,0,0), 2)
cv2.imshow("Image", img)
cv2.waitKey(1)