Install the ZED Python API

This section explains how to use the ZED SDK in Python 3 on Windows and Linux platforms.

Getting Started

The Python API is an open-source wrapper around the ZED SDK which is written in C++ optimized code. We make the ZED SDK accessible from external Python code using Cython.

To start using the ZED SDK in Python, you will need to install the following dependencies on your system:

  • ZED SDK (see Installation section)
  • Python 3.5+ (x64)
  • Cython 0.26+
  • Numpy 1.13+
  • OpenCV Python (optional)
  • PyOpenGL (optional)

Make sure to install Python (x64 version) and the pip package manager. Then install the dependencies via pip in a terminal.

python -m pip install cython numpy opencv-python pyopengl

Installing the Python API

Starting from ZED SDK 3.1, a python script is now installed on the ZED SDK installation folder and can detect the platform, CUDA and python version. Run this script to download the corresponding Python API package pre-compiled.

On Windows it’s in C:\Program Files (x86)\ZED SDK\ (make sure you have admin access to run it in Program Files), on Linux it can be found in /usr/local/zed/.

python get_python_api.py

Example:

# Going to the script location
$ cd "/usr/local/zed/"
$ python get_python_api.py

    # The script displays the detected platform versions
    CUDA 10.0
    Platform ubuntu18
    ZED 3.1
    Python 3.7
    # Download the whl package
    Downloading python package from https://download.stereolabs.com/zedsdk/3.1/ubuntu18/cu100/py37 ...

    # Gives instruction on how to setup it
    File saved into pyzed-3.1-cp37-cp37m-linux_x86_64.whl
    To install it run :
      python3 -m pip install pyzed-3.1-cp37-cp37m-linux_x86_64.whl

# Launching the installation from the downloaded package
$ python3 -m pip install pyzed-3.1-cp37-cp37m-linux_x86_64.whl

    Processing ./pyzed-3.1-cp37-cp37m-linux_x86_64.whl
    Installing collected packages: pyzed
    Successfully installed pyzed-3.1

That’s it ! The Python API is now installed. Check out the next section to see how to use the samples and tutorials.

If you need, the Python API is open source and can alternatively be compiled manually, see the Github repository