Summary
How to set up the OpenVINO™ environment within the context of VS2019
Description
- Tried to run an OpenVINO™ sample from within VS2019
- Encountered error: no module named 'openvino'
Resolution
The OpenVINO™ environment variables must be set before running an OpenVINO™ application. Run setupvars.bat in the terminal or environment in which the program will run.
Follow the OpenVINO™ installation guide
There are two options to implement this with VS2019:
Option 1:
VS2019 Developer Powershell
- Open <your sample> from OpenVINO™ folder in VS2019
- Create backup file of the code if necessary
- Set <your sample> as startup item
- Run setupvars.bat in the VS2019 Developer Powershell
- Run the sample application
Option 2:
Automate the OpenVINO™ setupvars.bat and VS2019 initialization using batch file
- Create a batch file that initializes the OpenVINO™ environment and opens VS2019
- Write the script below in the .bat file:
@echo on
cd <OpenVINO location>\bin
CALL setupvars.bat
cd <Microsoft Visual Studio location>\2019\Community\Common7\IDE
CALL devenv.exe - Run the .bat file as administrator
- After the VS2019 opens, select <your sample> from OpenVINO™ folder
- Create backup file if necessary
- Set <your sample> as startup item
- Run the sample application