ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

MediaPipe 在 Windows 上 import 报 ImportError: DLL load failed 怎么解决?

MediaPipe 在 Windows 上 import 报 ImportError: DLL load failed 怎么解决? MediaPipe 在 Windows 上 import 报 ImportError: DLL load failed 怎么解决【免费下载链接】mediapipeCross-platform, customizable ML solutions for live and streaming media.项目地址: https://gitcode.com/GitHub_Trending/med/mediapipe在 Windows 上通过pip install mediapipe装好 MediaPipe Python 包后启动 Python 解释器执行import mediapipe as mp时可能出现这样的报错ImportError: DLL load failed: The specified module could not be found这篇内容对应 MediaPipe 官方 troubleshooting 文档中的 Python DLL load failure on Windows 一节说明这个报错的成因和官方给出的两种解决办法。适用前提是MediaPipe Python 包来自 PyPI官方支持的 Windows 环境为 amd64 Windows 上的 64 位 Pythondocs/getting_started/troubleshooting.md 中 Python pip install failure 一节列出的支持范围为 x86_64 Linux、x86_64 macOS 10.15 和 amd64 Windows。先确认是这一类报错这个报错发生在import 阶段而不是pip install mediapipe阶段包已经装上了但 Python 加载其中的本地库时找不到所需的 DLL。报错信息以文档原文为准ImportError: DLL load failed: The specified module could not be found如果你遇到的是No matching distribution found for mediapipe那属于 pip 安装阶段的系统/Python 版本不受支持问题不在本文范围内见文末和相近报错的区分。原因官方文档的结论是该报错通常表示本地 Windows 系统缺少 Visual C redistributable 包和/或 Visual C 运行时 DLL。MediaPipe Python 包依赖这些运行时组件系统里缺失时 import 就会在加载本地库这一步失败。方案一安装 Microsoft 官方 Visual C 可再发行组件包官方文档给出的第一种解决方式是安装 Microsoft 官方的vc_redist.x64.exe链接指向 Microsoft 官方的 The latest supported Visual C downloads 页面可从 docs/getting_started/troubleshooting.md 原文查看下载地址。这是对系统的影响在 Windows 系统层面安装 Visual C 运行时环境属于一次性修复装完后不需要改动任何 MediaPipe 配置。方案二通过 pip 安装 msvc-runtime 包替代路径如果不想安装系统级的 redistributable 安装包官方文档给出的替代方式是在 Python 环境中安装 msvc-runtime 包python -m pip install msvc-runtime注意文档的明确说明msvc-runtime 这个 Python 包不是由 Microsoft 发布或维护的。选择哪种方案由你按环境自行决定文档并列给出、未做优先级排序。验证修复结果无论采用哪种方案修复完成后重新执行之前失败的 import 即可验证。MediaPipe Python 文档docs/getting_started/python.md展示的正常用法就是import mediapipe as mp mp_face_mesh mp.solutions.face_mesh之前在这一步抛出ImportError: DLL load failed的修复后应能正常完成 import 并成功取到mp_face_mesh不再出现该报错。和相近报错的区分troubleshooting 文档中还有两条容易混淆的条目对照可以避免走错方向ERROR: Could not find a version that satisfies the requirement mediapipe/ERROR: No matching distribution found for mediapipe出现在pip install mediapipe阶段表示当前系统或 Python 版本不在 PyPI 官方支持范围64 位 Python x86_64 Linux / x86_64 macOS 10.15 / amd64 Windows。文档建议核对 Python 与 pip 的版本或按 python.md 中的 Building MediaPipe Python Package 从源码构建。ImportError: No module named numpy缺少 Python 依赖包按文档用pip install或pip3 install安装对应包即可与 DLL 问题无关。如果确认报错就是ImportError: DLL load failed: The specified module could not be found按上面方案一或方案二处理后重新 import 验证即可详细条目见 docs/getting_started/troubleshooting.md 的 Python DLL load failure on Windows 一节。【免费下载链接】mediapipeCross-platform, customizable ML solutions for live and streaming media.项目地址: https://gitcode.com/GitHub_Trending/med/mediapipe创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表