gpt4 book ai didi

python - PyGIWarning : Gtk and Rsvg were imported without specifying a version first. 使用 gi.require_version

转载 作者:行者123 更新时间:2023-12-04 19:30:16 29 4
gpt4 key购买 nike

$ python -c '从 gi.repository 导入 Gtk'-c:1: PyGIWarning: 导入 Gtk 时未先指定版本。在导入之前使用 gi.require_version('Gtk', '3.0') 以确保加载正确的版本。我该怎么办?

最佳答案

您收到警告是因为您在导入 gtk 时未指定版本。这是因为 gtk 有多个版本,所以你应该声明要使用哪个版本。

为此,您可以打开 python 终端(在命令行中键入 python)并执行以下代码:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

关于python - PyGIWarning : Gtk and Rsvg were imported without specifying a version first. 使用 gi.require_version,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63631072/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com