pygobject 包用 pip 安装失败

Leap 15.5 是默认 python3.6 的,但我另外安装了 python3.11 和 pip

由于想快速使用某个软件,需要安装 pygobject 以提供 import gi 语句,运行:
python3.11 -m pip --debug install pygobject
… 由于输出信息太多,就不贴了,关键错误如下:
No package ‘gobject-introspection-1.0’ found
Command ‘(‘pkg-config’, ‘–print-errors’, ‘–exists’, ‘gobject-introspection-1.0 >= 1.56.0’)’ returned non-zero exit status 1.

用 zypper se gobject-intro 会搜出一个包:gobject-introspection
用 zypper info gobject-introspection 可以看到版本是 1.70.0-150400.2.10
但这个包名 gobject-introspection 与 gobject-introspection-1.0 两者是不匹配的。

我看了下这个包的 setup.py,其中有:
if find_executable(“apt”):

elif find_executable(“dnf”):

看上去像是通过高级包管理判断是否有依赖包。

这就有两个问题了:
1、高级包管理没有使用 zypper
2、就算加了 dnf 包装,但包名也是无法匹配的。

我对 python 开发不太熟, 不清楚一般这类问题的处理方法是怎样的?

使用 zypper 安装 gobject-introspection,不行吗?

这个就是命令啊,具体找的是 /usr/lib64/pkgconfig/gobject-introspection-1.0.pc。

直接安装 gobject-introspection 即可。