我正在尝试为 GStreamer 安装 Python 绑定,但该库已列入黑名单。我的 Dockerfile 如下。一切安装都没有问题,但
libgstpython.so
库被列入黑名单。我尝试过不同的Python版本,指定Python路径,以及随机键盘敲打,但没有成功。
FROM ubuntu:24.04
# Install Python
ARG PYTHON_VERSION=3.9.18
WORKDIR /opt
RUN apt update -y && apt upgrade -y && \
apt install -y libbz2-dev libsqlite3-dev zlib1g-dev libffi-dev wget curl build-essential libssl-dev openssl vim && \
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \
tar xzvf Python-${PYTHON_VERSION}.tgz && \
cd Python-${PYTHON_VERSION} && \
./configure --enable-shared && \
make && \
make install && \
ln -s /usr/local/bin/python3 /usr/bin/python && \
ln -s /usr/local/bin/pip3 /usr/bin/pip
# # Install FFmpeg, GStreamer, and reqs for custom plugins
RUN apt update && apt upgrade -y && apt install -y \
ffmpeg \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-bad1.0-dev \
libhdf5-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-base-apps \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
gstreamer1.0-tools \
gstreamer1.0-x \
gstreamer1.0-alsa \
gstreamer1.0-gl \
gstreamer1.0-gtk3 \
gstreamer1.0-qt5 \
gstreamer1.0-pulseaudio \
graphviz \
python3-gi \
python3-gst-1.0 \
libgirepository1.0-dev \
cmake \
python-gi-dev \
libcairo2-dev \
ninja-build \
git \
flex \
bison
# # NOTE: pygobject 3.47.0 introduced a bug
# # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3353
WORKDIR /opt
RUN pip install pycairo pygobject==3.46.0 meson pipenv
RUN GSTREAMER_VERSION=$(gst-launch-1.0 --version | grep version | tr -s ' ' '\n' | tail -1) \
&& export GIT_SSL_NO_VERIFY=1 \
&& git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git \
&& cd gstreamer \
&& git checkout $GSTREAMER_VERSION \
&& cd subprojects/gst-python \
&& PREFIX=$(dirname $(dirname $(which python))) \
&& meson setup --prefix=$PREFIX builddir \
&& ninja -C builddir \
&& meson install -C builddir
# Install other dependencies
ENV GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0
这是
gst-inspect-1.0
的输出:
# gst-inspect-1.0 -b
Blacklisted files:
libgstpython.so
Total count: 1 blacklisted file
编辑:
安装
apt install gstreamer1.0-python3-plugin-loader
而不是从源代码构建库时也会发生同样的事情。
编辑:
GST_DEBUG=4 gst-inspect-1.0 libgstpython.so
的输出在这个要点中。完整的输出太长,无法包含在帖子中,但对我来说最突出的一行是 492:
** (gst-plugin-scanner:15): CRITICAL **: 18:14:35.880: gi.repository.Gst is no dict
这里有一些可能有帮助的想法:
~/.cache/gstreamer-1.0/
,然后使用 gst-inspect-1.0 -b
重新加载插件应该有助于消除这种可能性。GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0
的内容。此外,您应该验证 PYTHONPATH 和 LB_LIBRARY_PATH 环境变量设置是否正确:PYTHONPATH=/usr/lib/python3.9/site-packages
和 LD_LIBRARY_PATH=/usr/local/lib
。 (来源)