动态链接库(DLL)初始化例程失败

ImportError: DLL load failed while importing onnxruntime_pybind11_state: 动态链接库(DLL)初始化例程失败

场景:python 3.10 版本,使用 MarkItDown v0.1.1 时,报错 ImportError: DLL load failed while importing onnxruntime_pybind11_state: 动态链接库(DLL)初始化例程失败

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 卸载 GPU 和 CPU 版本避免冲突
pip uninstall onnxruntime -y
pip uninstall onnxruntime-gpu -y

# 清理 pip 缓存
pip cache purge

# 然后根据需要只装一个版本:
# 如果你要使用 GPU(CUDA 支持)
pip install onnxruntime-gpu==1.16.0

# 或者如果你只用 CPU
pip install onnxruntime==1.21.1

还不行的话,安装 Visual C++ 2019 可再发行组件包

使用搜索引擎排查错误,得知可能是 DLL 初始化失败可能与系统运行时库缺失有关,尝试安装 Microsoft Visual C++ 2019 Redistributable:

下载 Visual C++ 2019 可再发行组件包Visual C++ 2019 可再发行组件包


0%