pygobject-2.28.6无法配置:找不到包“gobject-introspection-1.0”,我该如何解决?

60

我正在尝试在cygwin中编译pygobject-2.28.6(仓库中的版本为2.28.4,存在一些问题)。这是./configure的末尾:

checking for GLIB - version >= 2.24.0... yes (version 2.34.3)
checking for ffi... checking for FFI... yes
checking for GIO... yes
checking for GIOUNIX... yes
checking for GI... no
configure: error: Package requirements (glib-2.0 >= 2.24.0
        gobject-introspection-1.0 >= 0.10.2
    ) were not met:

No package 'gobject-introspection-1.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GI_CFLAGS
and GI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

我已安装gobject-introspection 1.34.2-3。如下所示:

$ whereis gobject-introspection
gobject-introspection: /lib/gobject-introspection /usr/lib/gobject-introspection

这里

$ whereis gobject-introspection-1.0
gobject-introspection-1: /usr/share/gobject-introspection-1.0

我已经尝试将 configure 中的 GI_CFLAGS 和 GI_LIBS 设置为 /lib/、/usr/lib/(甚至是 /usr/share/),但都无济于事。还有什么其他办法可以尝试解决这个问题吗?感谢您的时间!

5个回答

106

您可能缺少开发包。该软件包的名称因发行版而异,但它包含/usr/lib/pkgconfig/gobject-introspection-1.0.pc(某些 64 位发行版为/usr/lib64/pkgconfig/gobject-introspection-1.0.pc):

  • Fedora、CentOS、RHEL 等:gobject-introspection-devel
  • Debian、Ubuntu、Mint 等:libgirepository1.0-dev
  • Arch:gobject-introspection
  • FreeBSD:gobject-introspection
  • Cygwin:libgirepository1.0-devel
  • msys2:mingw-w64-x86_64-gobject-introspection 和/或 mingw-w64-i686-gobject-introspection

1
我找不到任何可用的这样的软件包。我已经放弃并决定不再使用cygwin来实现我原本打算的目的。不过还是谢谢你的回答! - Stupac
@Stupac 做得好。Cygwin相当糟糕。我知道你的评论已经过时了,但现在我使用WSL比使用cygwin更成功。 - Tyler Marshall

20

我已将此代码在Cygwin上编译成功。所需软件包为:libgirepository1.0-devel

在Ubuntu中,它被称为libgirepository1.0-dev


3

我没有足够的声望来发表评论,所以这实际上是对nemequ答案的补充:

  • MSYS2:mingw-w64-x86_64-gobject-introspection 和/或 mingw-w64-i686-gobject-introspection

3

对于 macOS {我的是(Intel CPU)}:

 brew install pygobject3 gtk+3
 pip install --no-use-pep517 PyGObject

它在Python 2.7虚拟环境中运行正常。

0

在运行pip install pygobject时出现的错误信息:

Collecting pygobject
  Using cached PyGObject-3.42.2.tar.gz (719 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pycairo>=1.16.0
  Using cached pycairo-1.21.0-cp39-cp39-linux_x86_64.whl
Building wheels for collected packages: pygobject
  Building wheel for pygobject (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pygobject (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/pygtkcompat
      copying pygtkcompat/pygtkcompat.py -> build/lib.linux-x86_64-cpython-39/pygtkcompat
      copying pygtkcompat/generictreemodel.py -> build/lib.linux-x86_64-cpython-39/pygtkcompat
      copying pygtkcompat/__init__.py -> build/lib.linux-x86_64-cpython-39/pygtkcompat
      creating build/lib.linux-x86_64-cpython-39/gi
      copying gi/types.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/pygtkcompat.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/module.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/importer.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/docstring.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_signalhelper.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_propertyhelper.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_ossighelper.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_option.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_gtktemplate.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_error.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_constants.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/__init__.py -> build/lib.linux-x86_64-cpython-39/gi
      creating build/lib.linux-x86_64-cpython-39/gi/repository
      copying gi/repository/__init__.py -> build/lib.linux-x86_64-cpython-39/gi/repository
      creating build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/keysyms.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/__init__.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Pango.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Gtk.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Gio.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GdkPixbuf.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Gdk.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GObject.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GLib.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GIMarshallingTests.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      running build_ext
      Package gobject-introspection-1.0 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'gobject-introspection-1.0', required by 'virtual:world', not found
      Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.56.0')' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pygobject
Failed to build pygobject
ERROR: Could not build wheels for pygobject, which is required to install pyproject.toml-based projects

没有提到 'gobject-introspection-1.0',但是这个文档提到了设置gobject-introspection的命令,并且顺利解决了我的问题。

sudo pacman -S --noconfirm python-wheel
sudo pacman -S --noconfirm base-devel openssl zlib git gobject-introspection

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接