同一个软件包的多个版本可以共存于同一个系统上吗?

the*_*fog 6 package-management apt dependencies

为了安装 tmux 2.1,我需要安装libtinfo5版本 6,我通过下载包含libtinfo5和直接使用命令安装的 .deb 存档来做到这一点:

sudo dpkg -i libtinfo5_6.0+20160213-1ubuntu1_amd64.deb
Run Code Online (Sandbox Code Playgroud)

这满足了 tmux 2.1 的依赖,并且 tmux 安装正常。
现在我尝试使用安装 vnstat

sudo apt-get install vnstat 
Run Code Online (Sandbox Code Playgroud)

apt-get 错误退出,如下

$ sudo apt-get install vnstat
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libncurses5 : Depends: libtinfo5 (= 5.9+20150516-2ubuntu1) but 6.0+20160213-1ubuntu1 is to be installed
 libncursesw5 : Depends: libtinfo5 (= 5.9+20150516-2ubuntu1) but 6.0+20160213-1ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Run Code Online (Sandbox Code Playgroud)

我的理解一直是 Ubuntu 的包管理系统能够安装和管理同一包的多个版本,适用于这种情况。换句话说 apt/dpkg 识别

  • tmux需要 libtinfo5 -version 6工作
  • vnstat需要 libtinfo5 -version 5工作

Then apt/dpkg say's ok, I'll install both versions.
I can see how certain programs like a system binary, e.g. bash or ls can only be installed once as most invocations simply say bash -c "<command>" and not bashv.3.2 -c "<command>".
So my question is can the package manager install and manage multiple dependencies?, or is this just not possible because, like in the bash example above, most programs make a call to the dependency by the dependencies name without specifying version. In which case the issue is beyond the control of the package manager (i.e. its more of a programming compilation/configuration/organisation issue) and the package manager gives up at that point?

Ste*_*ico 6

不,同一个包不可能有两个版本,因为会有冲突的文件。如果一个能够同时安装在两个不同的版本中则是另一回事。如果您足够勇敢,您可以获取一个版本的源代码,然后看看是否可以将其安装到其他目​​录。这很可能会以令人讨厌的方式搞乱你的系统。它也可能根本不起作用。Dpkg 不会满足,因此您必须获取其中一个程序的源代码并对其进行编译。但请记住,一旦你开始自己编译程序,你可能会给自己带来各种各样的问题。