运行Parrot示例脚本报错:ValueError: 无法加载edgetpu.dll
解决PyCoral加载edgetpu.dll失败的问题
问题重现
执行命令:
python examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg
完整报错堆栈:
Microsoft Windows [Version 10.0.22621.1992] (c) Microsoft Corporation. All rights reserved. C:\Users\chris>cd C:\Users\chris\coral\pycoral C:\Users\chris\coral\pycoral>python examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg Traceback (most recent call last): File "C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate delegate = Delegate(library, options) File "C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\site-packages\tflite_runtime\interpreter.py", line 119, in __init__ raise ValueError(capture.message) ValueError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\chris\coral\pycoral\examples\classify_image.py", line 121, in <module> main() File "C:\Users\chris\coral\pycoral\examples\classify_image.py", line 71, in main interpreter = make_interpreter(*args.model.split('@')) File "C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\site-packages\pycoral\utils\edgetpu.py", line 87, in make_interpreter delegates = [load_edgetpu_delegate({'device': device} if device else {})] File "C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\site-packages\pycoral\utils\edgetpu.py", line 52, in load_edgetpu_delegate return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {}) File "C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\site-packages\tflite_runtime\interpreter.py", line 162, in load_delegate raise ValueError('Failed to load delegate from {}\n{}'.format( ValueError: Failed to load delegate from edgetpu.dll
排查与解决步骤
- 确认Python版本与位数:PyCoral在Windows环境下仅支持Python 3.9 64位,32位Python无法兼容64位的edgetpu.dll。执行以下命令检查当前Python位数:
返回python -c "import sys; print(sys.maxsize > 2**32)"True为64位,False则需重装64位Python 3.9。 - 匹配依赖版本:确保
pycoral、tflite-runtime与edgetpu驱动版本完全兼容,建议安装官方指定的稳定版本:
同时确认edgetpu.dll是从官方Coral驱动包中获取的对应版本,不要使用非官方来源的文件。pip install pycoral==2.0.0 tflite-runtime==2.5.0.post1 - 权限与路径检查:
- 以管理员权限启动CMD终端,避免加载系统库时的权限限制。
- 检查系统PATH是否包含
C:\Windows\System32(默认已包含,若未添加需手动补充)。
- 硬件连接验证:若使用USB Coral加速器,确认设备已正确连接,Windows设备管理器中无设备异常(黄色感叹号),驱动安装完整。
内容的提问来源于stack exchange,提问作者Chris Doherty
相关产品推荐
相关产品推荐

