【问题标题】:How to setup Python virtual environment with bindings for gstreamer?如何使用 gstreamer 的绑定设置 Python 虚拟环境?
【发布时间】:2020-10-08 13:41:58
【问题描述】:

我想在我的 python 代码中使用 gstreamer 库 (1.0+)。正如他们在their website 中提到的那样,他们提供了 python 绑定,但不幸的是,他们没有提供有关如何启动和运行它的任何其他信息。

有人可以提供有关如何安装所有必需软件包(最好使用pip)的分步说明,以便在 python 虚拟环境中使用 gstreamer。一个最小的工作示例也将受到高度赞赏。

ps:我正在开发 Ububtu 18.04

【问题讨论】:

    标签: python python-3.x gstreamer gstreamer-1.0


    【解决方案1】:

    查看他们的示例:

    https://gitlab.freedesktop.org/gstreamer/gst-python/-/tree/master/examples

    所有开始的东西都应该在那里。

    【讨论】:

    • 我确实遵循了这一点。我克隆了存储库,创建了一个新的虚拟环境,从examples/requiremnts.txt 安装包并尝试运行examples/helloworld.py 脚本。脚本失败并显示错误消息:AttributeError: module 'gi' has no attribute 'require_version'
    • 你需要 python3-gi,一个可以与所有面向 GObject 的库对话的库。
    【解决方案2】:

    为了将 gstreamer 与 python 绑定一起使用,必须安装 PyGObject 包。
    设置过程如下:

    1. 打开终端并进入您的虚拟环境
    2. 执行sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0安装构建依赖和GTK
    3. 执行pip3 install pycairo 构建和安装Pycairo
    4. 执行pip3 install PyGObject 构建和安装PyGObject

    可以在此处找到更全面的指南:
    https://pygobject.readthedocs.io/en/latest/getting_started.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-23
      • 2021-03-22
      • 1970-01-01
      • 2021-05-02
      • 1970-01-01
      • 2019-07-19
      相关资源
      最近更新 更多