Jetson NX + Jetpack4.4 + Ubuntu18.04安装PyRealsense包
目前还没有arm架构下的pyralsense2的PyPi包,因此在jetson使用pip安装的话,无法找到满足的版本。在python3下import pyrealsense2显示ImportError: No module named pyrealsense2
我应该是从第二步开始操作的。
第一步:更新apt源,安装依赖
# Installs librealsense and pyrealsense2 on the Jetson NX running Ubuntu 18.04
# and using Python 3
# Tested on a Jetson NX running Ubuntu 18.04 and Python 3.6.9 on 2021-01-25
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y --no-install-recommends \python3 \python3-setuptools \python3-pip \python3-dev# Install the core packages required to build librealsense libs
sudo apt-get install -y git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
# Install Distribution-specific packages for Ubuntu 18
sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
第二步:从源编译librealsense。
先从这里https://github.com/IntelRealSense/librealsense/releases/下载zip2.45版本包,解压后进入librealsense下:
cd librealsense
第三步:确定你的realsense 没有 与NX连接,执行许可证脚本
./scripts/setup_udev_rules.sh
第四步:创建build文件夹,并在build下进行cmake编译
如果执行cmake编译失败,可能是由于cuda没有配置到bashrc中。
export PATH=/usr/local/cuda-10.2/bin/:$PATH
然后重新执行下面
# Now the build
mkdir build && cd build
## Install CMake with Python bindings (that's what the -DBUILD flag is for)
## see link: https://github.com/IntelRealSense/librealsense/issues/6964#issuecomment-707501049
cmake ../ -DFORCE_RSUSB_BACKEND=ON -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true -DBUILD_WITH_CUDA:bool=true
## Recompile and install librealsense binaries
## This is gonna take a while! The -j4 flag means to use 4 cores in parallel
## but you can remove it and simply run `sudo make` instead, which will take longer
sudo make uninstall
sudo make clean
make -j4
sudo make install
第五步:在你的/.bashrc下加入你的路径
sudo gedit ~/.bashrc
export PATH=$PATH:~/.local/bin
export PYTHONPATH=$PYTHONPATH:/usr/local/lib
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/pyrealsense2
source /.bashrc