我想运行一些官方的 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")
我正在使用 Movidius 在 Raspberry Pi 3B 上进行测试
Neural Compute Stick 1 (NCS1)
.Raspberry Pi OS 32-bit (Legacy) Buster
(因为Bullseye
不支持NCS1)。l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz
,这是设置 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
不见了。python3.7
下没有/opt/intel/openvino/python/
目录,但是/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
任何地方。