没有名为 gi 的模块

问题描述 投票:0回答:3

我已经尝试了下面给出的所有可能的命令:

pip 安装 pgi 、pip 安装 PyGObject 、pip 安装 python-gi

仍然无法在 python 中安装模块。 安装了python 3.7也尝试制作虚拟环境但无法安装模块。

#import cv2
import gi
import numpy as np

gi.require_version('Gst', '1.0')
from gi.repository import Gst
python gstreamer python-module
3个回答
16
投票

试试这个:

sudo apt install libcairo2-dev libxt-dev libgirepository1.0-dev

pip install pycairo PyGObject

0
投票

在基于 Arch 的发行版中,这对我有用。您可以使用另一个 AUR 助手,例如 Pamac 或 Yay,而不是 Paru。

paru -S gobject-introspection 
pip install pygobject

0
投票

我在 Ubuntu 20.04 上正确地删除了我的 python 设置。我试图使用 apt-add-repository 并得到“ModuleNotFoundError:没有名为“gi”的模块”。我已经使用 apt 安装了 software-properties-common 和 python3-gi。对我来说答案是

sudo apt-get --reinstall install python3-gi
© www.soinside.com 2019 - 2024. All rights reserved.