How to Build the Open-Source OpenVINO™ toolkit for Linux* from Source with the Python* API Wrapper
To use Python* with the open-source OpenVINO™ toolkit - Deep Learning Deployment Toolkit for Linux*, you must install Python 3.5 or above, and then build the toolkit by specifying the correct Python version in the CMake command line.
If you do not explicitly specify a Python version, CMake picks up the system-level Python version, which is 2.7, and your Python scripts will not work.
Note | The instructions below assume you have already installed Python*. |
- Build from source.
Refer to the Building for Linux instructions for more detailed steps.
$ git clone https://github.com/openvinotoolkit/openvino.git
$ cd openvino
$ git submodule update --init --recursive
$ chmod +x install_dependencies.sh
$ ./install_dependencies.sh
$ mkdir build && cd buildNote In the CMake command line below, substitute 3.6 with your version of Python*. The location of Python depends on the architecture and operating system.
$ cmake -DCMAKE_BUILD_TYPE=Release \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=`which python3.6` \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.6 ..
$ make --jobs=$(nproc --all) - Export environment variables.
After the build process finishes, export the environment variables:
$ export PYTHONPATH=$PYTHONPATH:/~/openvino/bin/intel64/Release/lib/python_api/python3.6/
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/openvino/bin/intel64/Release/lib/ - Test the build.
Check that you correctly built the Python wrapper by running the following script to import IENetwork and IECore:
$ python3.6
>>> from openvino.inference_engine import IENetwork, IECore
If you can successfully import IENetwork and IECore, you have correctly built the OpenVINO toolkit with the Python wrapper.