【问题标题】:Issues with installing librealsense with Balena. Unable to locate file after make install?使用 Balena 安装 librealsense 的问题。安装后找不到文件?
【发布时间】:2021-04-01 13:41:59
【问题描述】:

我一直在尝试使用 Balena 在我的 Raspberry Pi4 上设置 librealsense。我的 docker 文件如下所示:

FROM balenalib/raspberrypi3-ubuntu:xenial-build
RUN sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y
RUN sudo apt-get install -y python3 \
    python3-dev \
    python3-pip \
    python3-setuptools 

RUN sudo apt-get install -y git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev cmake libglfw3-dev build-essential 
RUN git clone https://github.com/IntelRealSense/librealsense.git
RUN cd librealsense/ && ./scripts/setup_udev_rules.sh
RUN mkdir build &&\
    cd build &&\
    cmake /librealsense/ -DBUILD_PYTHON_BINDINGS=true -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false -DCMAKE_BUILD_TYPE=Release &&\
    make all -j4 &&\
    sudo make all 

COPY librealsense/build/ /usr/src/app/

#switch on systemd init system in container
ENV INITSYSTEM on

WORKDIR /usr/src/app
COPY ./app/ /usr/src/app/


#Run our binary on container startup
CMD ["python3", "/usr/src/app/test_server.py"]

我的 test_server.py 看起来像:

import sys, os
print("TEST")
rootdir = '/usr/src/app'
for f in os.listdir(rootdir):
    print(f)
print(sys.version)
try:
    user_paths = os.environ['PYTHONPATH'].split(os.pathsep)
except KeyError:
    user_paths = []
print(user_paths)
print(sys.path)
sys.path.append('/usr/src/app/')
import pyrealsense2 as rs

我无法导入 pyrealsense 或复制构建的 .so 文件以放入我的 python 应用程序文件夹。创建 docker 映像时出现“librealsense/build/python 不存在”错误。我的 librealsense 安装缺少什么?

【问题讨论】:

    标签: python raspberry-pi intel realsense balena


    【解决方案1】:

    我认为你的问题出在

    COPY librealsense/build/ /usr/src/app/
    

    这将尝试从您的构建上下文(又名主机)复制“librealsense/build”。您需要将 'RUN' 与 'cp' 一起使用,例如

    RUN cp librealsense/build/ /usr/src/app/
    

    或在单个 RUN 命令中:

    RUN mkdir build &&\
        cd build &&\
        cmake /librealsense/ -DBUILD_PYTHON_BINDINGS=true -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false -DCMAKE_BUILD_TYPE=Release &&\
        make all -j4 &&\
        sudo make all  &&\
        cp librealsense/build/ /usr/src/app/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-25
      • 2018-08-27
      • 1970-01-01
      相关资源
      最近更新 更多