Ubuntu 20.04 ImportError:没有名为 gtk.glade 的模块

Ubuntu 20.04 ImportError:没有名为 gtk.glade 的模块

我正在尝试启动一个旧的 python2 脚本。在 ubuntu 18.04 上,我安装了 python-glade2 并且它工作正常,不幸的是 ubuntu 20.04 在存储库中没有它。有没有办法获取这个 gtk.glade 模块?也许是其他提供它的库?

@edit:按照 N0rbert 的建议安装了 gtk/glade,但不幸的是我还需要 python-gdal,我尝试以类似的方式安装它,但出现错误:

The following packages have unmet dependencies. python-gdal : Depends: gdal-abi-2-2-3 but it is not installable Depends: libgdal20 (>= 2.2.2) but it is not installable E: Unable to correct problems, you have held broken packages.

我认为我需要的 Ubuntu 20 中的一些软件包与 ubuntu 18 中的一些软件包冲突。

输出apt-cache policy python-gdal libgdal20

python-gdal: Installed: (none) Candidate: (none) Version table: libgdal20: Installed: (none) Candidate: (none) Version table:

我想知道从 ubuntu 18 下载 .debs,然后仅提取 .py 文件并将它们复制到脚本目录中是否是唯一的选择——

答案1

可以使用 18.04 LTS 中的软件包通过以下命令手动安装python-gtk2python-glade2

cd ~/Downloads
wget -c http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-gtk2_2.24.0-5.1ubuntu2_amd64.deb
sudo apt-get install ./python-gtk2_2.24.0-5.1ubuntu2_amd64.deb

wget -c http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-glade2_2.24.0-5.1ubuntu2_amd64.deb
sudo apt-get install ./python-glade2_2.24.0-5.1ubuntu2_amd64.deb

相关内容