FileNotFoundError: The path does not exist , while using mediapipe for hand detection
FileNotFoundError: The path does not exist , while using mediapipe for hand detection
我正在尝试使用 mediapipe 在网络摄像头源上完成手部检测,但是当我 运行 代码时,我收到以下错误:
**File "D:\HandTracking\handtracking.py", line 9, in <module>
hands = mpHands.Hands()**
**File "C:\Users\Θανάσης\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solutions\hands.py", line 109, in __init__
super().__init__(**
**File "C:\Users\Θανάσης\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solution_base.py", line 237, in __init__
validated_graph.initialize(
FileNotFoundError: The path does not exist.**
**[ WARN:0] global C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-1i5nllza\opencv\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback**
代码为:
import cv2 as cv
import mediapipe as mp
capture = cv.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
while True:
isTrue, frame = capture.read()
frameRGB = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
results = hands.process(frameRGB)
cv.imshow("Frame", frame)
if cv.waitKey(20) & 0xFF == ord('d'):
break
capture.release()
cv.destroyAllWindows()
我使用 here 解决了这个问题。我认为问题是路径名上的路径编码。
所以主要思路是将用户文件夹名称改成英文
Microsoft提供了更改用户文件夹的方法供大家参考。
- Log in by using another administrative account.
Note : You may need create a new administrative account at first.
- Go to the C:\users\ folder and rename the sub folder with the original user name to the new user name.
- Go to registry and modify the registry value ProfileImagePath to the new path name. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList<User SID>\
Note : Replace with the new name you want to change to your user account.
- Log out and log in again by using the user whose name is changed, and the user should use the previous profile with new path name.
当项目路径中存在非unicode字符时,会出现此错误。它不仅与用户名有关,而且与路径名中包含的所有字符有关。例如,如果项目的路径名中包含“ç”、“ş”、“ü”、“ğ”、“ı”、“ö”等字符,则会出现此错误。
为了消除此错误,请在没有“非 unicode”字符的文件夹中构建项目。
它真的对我有用...
它对我也有用...
"当项目的路径中有非unicode字符时会出现这个错误。它不仅与用户名有关,而且与路径名中包含的所有字符有关。例如,如果您在您的项目的路径名,如“ç”、“ş”、“ü”、“ğ”、“ı”、“ö”等,您将遇到此错误。
我正在尝试使用 mediapipe 在网络摄像头源上完成手部检测,但是当我 运行 代码时,我收到以下错误:
**File "D:\HandTracking\handtracking.py", line 9, in <module>
hands = mpHands.Hands()**
**File "C:\Users\Θανάσης\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solutions\hands.py", line 109, in __init__
super().__init__(**
**File "C:\Users\Θανάσης\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solution_base.py", line 237, in __init__
validated_graph.initialize(
FileNotFoundError: The path does not exist.**
**[ WARN:0] global C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-1i5nllza\opencv\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback**
代码为:
import cv2 as cv
import mediapipe as mp
capture = cv.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
while True:
isTrue, frame = capture.read()
frameRGB = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
results = hands.process(frameRGB)
cv.imshow("Frame", frame)
if cv.waitKey(20) & 0xFF == ord('d'):
break
capture.release()
cv.destroyAllWindows()
我使用 here 解决了这个问题。我认为问题是路径名上的路径编码。
所以主要思路是将用户文件夹名称改成英文
Microsoft提供了更改用户文件夹的方法供大家参考。
- Log in by using another administrative account.
Note : You may need create a new administrative account at first.
- Go to the C:\users\ folder and rename the sub folder with the original user name to the new user name.
- Go to registry and modify the registry value ProfileImagePath to the new path name. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList<User SID>\
Note : Replace with the new name you want to change to your user account.
- Log out and log in again by using the user whose name is changed, and the user should use the previous profile with new path name.
当项目路径中存在非unicode字符时,会出现此错误。它不仅与用户名有关,而且与路径名中包含的所有字符有关。例如,如果项目的路径名中包含“ç”、“ş”、“ü”、“ğ”、“ı”、“ö”等字符,则会出现此错误。
为了消除此错误,请在没有“非 unicode”字符的文件夹中构建项目。
它真的对我有用...
它对我也有用...
"当项目的路径中有非unicode字符时会出现这个错误。它不仅与用户名有关,而且与路径名中包含的所有字符有关。例如,如果您在您的项目的路径名,如“ç”、“ş”、“ü”、“ğ”、“ı”、“ö”等,您将遇到此错误。