安装依赖项 .deb 包时出错:依赖于 python (>= 2.7~);但是:未安装 python 包

安装依赖项 .deb 包时出错:依赖于 python (>= 2.7~);但是:未安装 python 包

我正在尝试在 Xubuntu 22.04 中安装 PyRenamer.deb:https://launchpad.net/pyrenamer

Pyrenamer 是用 Python2 编写的,并且有几个 .deb 包依赖项,我已经下载并收集了这些依赖项。

我已经安装了 Python2,并且已经正确设置了 Python Alternatives,因此:

$ python -V
Python 2.7.18
$ python2 -V
Python 2.7.18
$ python3 -V
Python 3.10.4

因此,当我尝试安装依赖项 .deb 包之一时:

$ sudo dpkg -i python-gobject-2_2.28.6-12ubuntu3_amd64.deb

出现此错误消息:

dpkg: dependency problems prevent configuration of python-gobject-2:
 python-gobject-2 depends on python (<< 2.8); however:
  Package python is not installed.
 python-gobject-2 depends on python (>= 2.7~); however:
  Package python is not installed.

当安装了 Python 2.7.18 并且正确设置了 python 运行时,为什么我会收到此错误消息?我试了又试,也上网搜索过相关帮助,但找不到解决这个问题的方法。

$ dpkg -l '*python*'

||/ Name                          Version                  Architecture Description
+++-=============================-========================-============-================================================================================
ii  hexchat-python3:amd64         2.16.0-4build1           amd64        Python 3 plugin for HexChat
ii  libpython-all-dbg:amd64       2.7.18-3                 amd64        package depending on all supported Python2 debugging packages
ii  libpython-all-dev:amd64       2.7.18-3                 amd64        package depending on all supported Python2 development packages
un  libpython-dbg                 <none>                   <none>       (no description available)
un  libpython-dev                 <none>                   <none>       (no description available)
un  libpython-stdlib              <none>                   <none>       (no description available)
ii  libpython2-dbg:amd64          2.7.18-3                 amd64        debug build of the Python2 interpreter (version 2.7)
ii  libpython2-dev:amd64          2.7.18-3                 amd64        header files and a static library for Python2
ii  libpython2-stdlib:amd64       2.7.18-3                 amd64        interactive high-level object-oriented language (Python2)
ii  libpython2.7:amd64            2.7.18-13ubuntu1         amd64        Shared Python runtime library (version 2.7)
ii  libpython2.7-dbg:amd64        2.7.18-13ubuntu1         amd64        Debug Build of the Python Interpreter (version 2.7)
ii  libpython2.7-dev:amd64        2.7.18-13ubuntu1         amd64        Header files and a static library for Python (v2.7)
ii  libpython2.7-minimal:amd64    2.7.18-13ubuntu1         amd64        Minimal subset of the Python language (version 2.7)
ii  libpython2.7-stdlib:amd64     2.7.18-13ubuntu1         amd64        Interactive high-level object-oriented language (standard library, version 2.7)
ii  libpython2.7-testsuite        2.7.18-13ubuntu1         all          Testsuite for the Python standard library (v2.7)
ii  libpython3-stdlib:amd64       3.10.4-0ubuntu2          amd64        interactive high-level object-oriented language (default python3 version)
ii  libpython3.10:amd64           3.10.4-3                 amd64        Shared Python runtime library (version 3.10)
ii  libpython3.10-minimal:amd64   3.10.4-3                 amd64        Minimal subset of the Python language (version 3.10)
ii  libpython3.10-stdlib:amd64    3.10.4-3                 amd64        Interactive high-level object-oriented language (standard library, version 3.10)
un  libpython3.4-minimal          <none>                   <none>       (no description available)
un  libpython3.5-minimal          <none>                   <none>       (no description available)
un  libpython3.8-stdlib           <none>                   <none>       (no description available)
un  python                        <none>                   <none>       (no description available)
un  python-4suite                 <none>                   <none>       (no description available)
ii  python-all                    2.7.18-3                 amd64        package depending on all supported Python2 runtime versions
ii  python-all-dbg                2.7.18-3                 amd64        package depending on all supported Python2 debugging packages
ii  python-all-dev                2.7.18-3                 amd64        package depending on all supported Python2 development packages
un  python-apport 

我按照该网页上的说明进行操作:

https://linuxconfig.org/install-python-2-on-ubuntu-20-04-focal-fossa-linux

安装 python2,使用:

$ sudo apt update
$ sudo apt install python2

我按照该网页上的说明进行操作:

https://linuxconfig.org/ubuntu-20-04-python-version-switch-manager

设置 python 的替代方案:

$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path              Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3   2         auto mode
  1            /usr/bin/python2   1         manual mode
  2            /usr/bin/python3   2         manual mode

Press  to keep the current choice[*], or type selection number: 1

相关内容