openvino踩坑记(ImportError: DLL load failed while importing ie_api)
最近捣腾了一下windows版的openvino,发现这玩意有坑,不过网上踩坑的好像不多,相关的信息也较少。
事情是这样的,一开始我去官网下载exe安装包,具体的选择如下,
安装之后会存在指定的文件夹中,
并在这个文件夹中找到Intel\openvino_2021\deployment_tools\model_optimizer\install_prerequisites这个路径,在该路径下有几个bat文件
这几个bat文件就是帮你配置环境的,我用的是onnx所以控制台运行的是install_prerequisites_onnx.bat,运行完之后在\Intel\openvino_2021\bin这个路径下的bat文件也要在控制台运行,
运行完了会和你说环境初始化完成。
但是实际上运行的时候还是会报错,提示:ImportError: DLL load failed while importing ie_api: 找不到指定的模块。
Traceback (most recent call last):File "F:/DLproject/YOLOX-main/demo/OpenVINO/python/openvino_inference.py", line 15, in <module>from openvino.inference_engine import IECoreFile "E:\ProgramData\Anaconda3\envs\yolo\lib\site-packages\openvino\inference_engine\__init__.py", line 31, in <module>from .ie_api import *
ImportError: DLL load failed while importing ie_api: 找不到指定的模块。
然后上网一通找,基本操作就是按上面的再来一遍,我再来一遍之后还是报同样的错。在环境变量中添加项目路径也还是找不到这个指定模块。
之后根据官方的pip方式,在自己的环境下运行下列指令:
python -m pip install --upgrade pip
pip install openvino
pip install openvino-dev[onnx]==2021.4.2
不出意外的还是出意外了,还是和上面的错误一样,最后无奈,路径问题就是比较麻烦,只能改一下代码
在__init__.py文件中的对应位置加上:
os.environ['PATH'] = os.path.abspath(lib_path) + ';' + os.environ['PATH']
具体如下:
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0import os
import sysif sys.platform == 'win32':# Installer, yum, pip installs openvino dlls to the different directories# and those paths need to be visible to the openvino modules## If you're using a custom installation of openvino,# add the location of openvino dlls to your system PATH.## looking for the libs in the pip installation path by default.openvino_libs = [os.path.join(os.path.dirname(__file__), '..', '..', 'openvino', 'libs')]# setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable.openvino_libs_installer = os.getenv('OPENVINO_LIB_PATHS')if openvino_libs_installer:openvino_libs.extend(openvino_libs_installer.split(';'))for lib in openvino_libs:lib_path = os.path.join(os.path.dirname(__file__), lib)if os.path.isdir(lib_path):# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.if (3, 8) <= sys.version_info:os.add_dll_directory(os.path.abspath(lib_path))# 加上这句os.environ['PATH'] = os.path.abspath(lib_path) + ';' + os.environ['PATH']else:os.environ['PATH'] = os.path.abspath(lib_path) + ';' + os.environ['PATH']from .ie_api import *__all__ = ['IENetwork', 'TensorDesc', 'IECore', 'Blob', 'PreProcessInfo', 'get_version']
__version__ = get_version() # type: ignore
之后问题解决,可以正常进行模型推理。
推理时的日志信息
openvino踩坑记(ImportError: DLL load failed while importing ie_api)相关推荐
- Django终端运行报错:ImportError: DLL load failed while importing _sqlite3: 找不到指定的模块。
在pycharm运行没问题,但是在终端cmd或Powershell就会出错,如下: Traceback (most recent call last):File ".\manage.py&q ...
- from PyQt6 import QtCore, QtGui, QtWidgets ImportError: DLL load failed while importing QtGui:
from PyQt6 import QtCore, QtGui, QtWidgets ImportError: DLL load failed while importing QtGui: 找不到指定 ...
- ImportError: DLL load failed while importing _openmp_helpers: 拒绝访问。sklearn库拒绝访问
在运行以下的代码时,这两个代码全都报了这个错误 from sklearn.metrics import mean_squared_errorfrom sklearn.preprocessing imp ...
- ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块(pyinstaller打包的问题)
本人环境配置: RTX3060 Win10 cuda11.1 Python3.8 Pytorch1.7.1 问题描述 本人需要将有导入torch包的python文件通过pyinstaller打包生成e ...
- Miniconda, ImportError: DLL load failed while importing win32api
Miniconda环境中 pip install pywin32 然后使用出错 import win32api ImportError: DLL load failed while importing ...
- ImportError: DLL load failed while importing win32api
今天在装jupyterlab环境的时候,老是跳出ImportError: DLL load failed while importing win32api: 找不到指定的模块. 我找到了网上的方法试了 ...
- 使用wxauto出现ImportError: DLL load failed while importing win32gui: 找不到指定的程序报错的解决方案
文章目录 背景 错误提示 解决方案 建议关注我的 微信公众号:破壳Ai,分享最佳学习路径.教程和资源.成长路上,我陪你. 背景 利用 wxauto 开发微信机器人,Pycharm 中运行程序时出错 错 ...
- ImportError: DLL load failed while importing _ctypes conda
更新conda环境conda update -n base conda 在更新的过程中报错ImportError: DLL load failed while importing _ctypes,网上 ...
- 【问题记录】ImportError: DLL load failed while importing _imaging: 找不到指定的模块
在 windows 上使用 matplotlib 包的时候报错如下: ImportError: DLL load failed while importing _imaging: 找不到指定的模块. ...
- Python使用Pillow包报错 ImportError: DLL load failed while importing _imaging: 找不到指定的程序。
最近使用Python调用Pillow时报错,代码就两行: from PIL import Imageprint("PyCharm") 报错如下: Traceback (most r ...
最新文章
- ajax: PopupControlExtender使用
- java中字符串转化为Ascii码
- 写给准备找工作的同志们!!!!(转载)
- SAP Marketing Cloud里获取Contact Interaction的postman请求
- Jmeter运行过程中如何让Fiddler同时可以抓获到服务器的应答报文
- C++学习——构造函数,析构函数与虚函数关系
- Win7 局域网内访问Sql2005
- 经典面试题(三):ASP.NET部分----ASP.NET 页面之间传递值的几种方式
- linux使网卡点亮_Linux下 无线网卡配置无线唤醒功能的方法
- windows下客户端连接上马上会断开连接_zookeeper系列客户端的骚操作amp; Curator使用...
- 当自动化测试遇到邮箱
- 山寨抢购 Intel欲提高Atom处理器售价
- Python-进制转换
- 动手下载网易课程视频 -- 正式下载
- 华南联络易-管理培训老师的神助手
- 谷歌又要来了?陆齐离开百度,拒绝巨头选YC | 一周学习排行
- 大学物理上册详细笔记_大学物理上册课堂笔记.pdf
- 织梦cms内容采集视频教程
- windows计算机锁屏的快捷键是什么,电脑锁屏快捷键是什么
- linux-top命令备忘
热门文章
- 提示缺少unicode打开乱码_教你如何破译乱码
- Android 音频系统:从 AudioTrack 到 AudioFlinger
- Operation-wise Attention Network for Tampering Localization Fusion
- 如何用电子书来做网络营销
- 在推送Git之前合并多个提交[重复]
- seaborn系列 (10) | 盒形图boxplot()
- js判断移动端还是pc端
- 6.5-6.7 理解线性方程组解的结构
- iOS Core Bluetooth 教程:心率监测
- 单片机c语言*乘法,单片机c语言教程:运算符和表达式(位运算符)