- Ensure apt-get is up to date
sudo apt-get update && sudo apt-get upgrade- Note: Use
sudo apt-get dist-upgrade, instead ofsudo apt-get upgrade, in case you have an older Ubuntu 14.04 version
- Install Python and its development files via apt-get (Python 2 and 3 both work)
sudo apt-get install python python-devorsudo apt-get install python3 python3-dev- Note: The project will only use Python 2 if it can't use Python 3
- Run the top level CMake command with the following additional flag
-DBUILD_PYTHON_BINDINGS:bool=true:
git clone https://github.com/IntelRealSense/librealsense.gitcd librealsense/wrapperscmake ../ -DBUILD_PYTHON_BINDINGS:bool=true
Note: To force compilation with a specific version on a system with both Python 2 and Python 3 installed, add the following flag to CMake command:
-DPYTHON_EXECUTABLE=[full path to the exact python executable]
make -j4sudo make install
- update your PYTHONPATH environment variable to add the path to the pyrealsense library
export PYTHONPATH=$PYTHONPATH:/usr/local/lib
- Alternatively, copy the build output (
librealsense2.soandpyrealsense2.so) next to your script.
- Note: Python 3 module filenames may contain additional information, e.g.
pyrealsense2.cpython-35m-arm-linux-gnueabihf.so)