Traceback (most recent call last):
File “D:\Python310\lib\runpy.py”, line 196, in run_module_as_main
return run_code(code, main_globals, None,
File “D:\Python310\lib\runpy.py”, line 86, in run_code
exec(code, run_globals)
File "D:\Python310\Scripts\labelme.exe_main.py", line 4, in
from labelme.main import main
File "D:\Python310\lib\site-packages\labelme_main.py", line 15, in
from labelme.app import MainWindow
File “D:\Python310\lib\site-packages\labelme\app.py”, line 21, in
from labelme.automation import bbox_from_text
File “D:\Python310\lib\site-packages\labelme_automation\bbox_from_text.py”, line 6, in
import osam
File "D:\Python310\lib\site-packages\osam_init.py", line 5, in
from . import apis # noqa: F401
File “D:\Python310\lib\site-packages\osam\apis.py”, line 5, in
import onnxruntime
File "D:\Python310\lib\site-packages\onnxruntime_init.py", line 61, in
raise import_capi_exception
File “D:\Python310\lib\site-packages\onnxruntime_init_.py”, line 24, in
from onnxruntime.capi._pybind_state import (
File “D:\Python310\lib\site-packages\onnxruntime\capi_pybind_state.py”, line 32, in
from .onnxruntime_pybind11_state import * # noqa
ImportError: DLL load failed while importing onnxruntime_pybind11_state: 动态链接库(DLL)初始化例程失败。
问题解决:
这个错误 ImportError: DLL load failed while importing onnxruntime_pybind11_state: 动态链接库(DLL)初始化例程失败 表明在导入 onnxruntime 库时,Python 无法加载必要的动态链接库(DLL)文件。
-
解决办法一:
卸载重新安装onnxruntimepip uninstall onnxruntime pip install onnxruntime
-
解决办法二:
降低版本,使用1.14.1版本pip install onnxruntime-gpu==1.14.1
基本可以解决