英文:
ModuleNotFoundError: No module named 'openvino'
问题
我想运行一些官方的OpenVINO示例,但我总是遇到以下错误:
from openvino.inference_engine import IECore
ModuleNotFoundError: No module named 'openvino'
我创建了一个简单的脚本来测试这个行为:
IECore_test.py
import sys
from openvino.inference_engine import IECore
ie=IECore()
print("End of test")
我在Raspberry Pi 3B上进行测试,使用Movidius Neural Compute Stick 1(NCS1)。操作系统是Raspberry Pi OS 32位(Legacy)Buster(因为Bullseye不支持NCS1)。OpenVINO版本是l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz,这是最后一个支持NCS1的版本。
以下是设置OpenVINO的步骤:
sudo mkdir -p /opt/intel/openvino
mkdir ~/download
cd ~/download
wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2020.3/l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz
sudo tar -xf l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz --strip 1 -C /opt/intel/openvino
echo "source /opt/intel/openvino/bin/setupvars.sh" >> ~/.bashrc
source /opt/intel/openvino/bin/setupvars.sh
sudo usermod -a -G users "$(whoami)"
sh /opt/intel/openvino/install_dependencies/install_NCS_udev_rules.sh
我在互联网上搜索后发现ie_api.so
起到了重要作用。我发现ie_api.so
位于以下位置:
/opt/intel/openvino/python/python3.5/openvino/inference_engine/ie_api.so
我检查了$PYTHONPATH
:
(openvino_env) pi@raspberrypi:~ $ echo $PYTHONPATH
/opt/intel/openvino/python/python3.7:
/opt/intel/openvino/python/python3:
/opt/intel/openvino/deployment_tools/model_optimizer:
一些原因,/opt/intel/openvino/python/python3.5
被漏掉了。(而且,在/opt/intel/openvino/python/
下没有python3.7
目录,但在/usr/lib/
下有一个。)
因此,我运行了以下两行:
export PYTHONPATH="/opt/intel/openvino/python/python3.5:$PYTHONPATH"
export PYTHONPATH="/opt/intel/openvino/python/python3.5/openvino/inference_engine:$PYTHONPATH"
现在$PYTHONPATH
如下:
(openvino_env) pi@raspberrypi:~ $ echo $PYTHONPATH
/opt/intel/openvino/python/python3.5/openvino/inference_engine:
/opt/intel/openvino/python/python3.5:
/opt/intel/openvino/python/python3.7:
/opt/intel/openvino/python/python3:
/opt/intel/openvino/deployment_tools/model_optimizer:
我认为它应该可以工作,但python3 IECore_test.py
返回另一个错误:
Traceback (most recent call last):
File "IECore_test.py", line 2, in <module>
from openvino.inference_engine import IECore
File "/opt/intel/openvino/python/python3.5/openvino/inference_engine/__init__.py", line 1, in <module>
from .ie_api import *
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
我找不到libpython3.5m.so.1.0
文件的位置。所以,我被困在这里。如何解决这些错误?
英文:
I'd like to run some official OpenVINO samples, but I always get the following error:
from openvino.inference_engine import IECore
ModuleNotFoundError: No module named 'openvino'
I created a simple script to test this behavior:
IECore_test.py
import sys
from openvino.inference_engine import IECore
ie=IECore()
print("End of test")
I'm testing on Raspberry Pi 3B with Movidius Neural Compute Stick 1 (NCS1)
.
The OS is Raspberry Pi OS 32-bit (Legacy) Buster
(because Bullseye
doesn't support NCS1).
OpenVINO Version is l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz
,
which is the last version that can support NCS1.
Here's the procedure to set up OpenVINO:
sudo mkdir -p /opt/intel/openvino
mkdir ~/download
cd ~/download
wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2020.3/l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz
sudo tar -xf l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz --strip 1 -C /opt/intel/openvino
echo "source /opt/intel/openvino/bin/setupvars.sh" >> ~/.bashrc
source /opt/intel/openvino/bin/setupvars.sh
sudo usermod -a -G users "$(whoami)"
sh /opt/intel/openvino/install_dependencies/install_NCS_udev_rules.sh
I searched on the Internet, then I noticed that ie_api.so
plays an important role.
I found that ie_api.so
is located here:
/opt/intel/openvino/python/python3.5/openvino/inference_engine/ie_api.so
I checked $PYTHONPATH
:
(openvino_env) pi@raspberrypi:~ $ echo $PYTHONPATH
/opt/intel/openvino/python/python3.7:
/opt/intel/openvino/python/python3:
/opt/intel/openvino/deployment_tools/model_optimizer:
Somehow, /opt/intel/openvino/python/python3.5
was missing.
(And, there is no python3.7
directory under /opt/intel/openvino/python/
, but there is one under /usr/lib/
.)
So, I ran these two lines:
export PYTHONPATH="/opt/intel/openvino/python/python3.5:$PYTHONPATH"
export PYTHONPATH="/opt/intel/openvino/python/python3.5/openvino/inference_engine:$PYTHONPATH"
Now $PYTHONPATH
is:
(openvino_env) pi@raspberrypi:~ $ echo $PYTHONPATH
/opt/intel/openvino/python/python3.5/openvino/inference_engine:
/opt/intel/openvino/python/python3.5:
/opt/intel/openvino/python/python3.7:
/opt/intel/openvino/python/python3:
/opt/intel/openvino/deployment_tools/model_optimizer:
I thought it would work, but python3 IECore_test.py
returns another error:
Traceback (most recent call last):
File "IECore_test.py", line 2, in <module>
from openvino.inference_engine import IECore
File "/opt/intel/openvino/python/python3.5/openvino/inference_engine/__init__.py", line 1, in <module>
from .ie_api import *
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
I can't find libpython3.5m.so.1.0
anywhere.
So, I'm stuck here.
How can I resolve these errors?
答案1
得分: 1
使用l_openvino_toolkit_runtime_raspbian_p_2020.3.355.tgz在树莓派上导入IECore
。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论