apt-get安装软件时 需要依赖更低版本的依赖库 通用解决办法

比如ubuntu尝试安装sqlite3,

xda@xda-dt:~$ sudo apt-get install sqlite3 libsqlite3-0=3.7.9-2ubuntu1.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libsqlite3-0 is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.

会出现上面的问题。

方法1,使用aptitude 安装。

xda@xda-dt:~$ sudo aptitude install sqlite3
The following NEW packages will be installed:
  sqlite3{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 26.9 kB of archives. After unpacking 174 kB will be used.
The following packages have unmet dependencies:
 sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     sqlite3 [Not Installed]                            



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:                                  
1)     libsqlite3-0 [3.7.9-2ubuntu1.1 (now) -> 3.7.9-2ubuntu1 (precise)]



Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
  libsqlite3-0 
The following NEW packages will be installed:
  sqlite3 
0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 375 kB of archives. After unpacking 174 kB will be used.
Do you want to continue? [Y/n/?] Y
Get: 1 http://hk.archive.ubuntu.com/ubuntu/ precise/main libsqlite3-0 amd64 3.7.9-2ubuntu1 [348 kB]
Get: 2 http://hk.archive.ubuntu.com/ubuntu/ precise/main sqlite3 amd64 3.7.9-2ubuntu1 [26.9 kB]
Fetched 375 kB in 1s (306 kB/s)    
dpkg: warning: downgrading libsqlite3-0 from 3.7.9-2ubuntu1.1 to 3.7.9-2ubuntu1.
(Reading database ... 162912 files and directories currently installed.)
Preparing to replace libsqlite3-0 3.7.9-2ubuntu1.1 (using .../libsqlite3-0_3.7.9-2ubuntu1_amd64.deb) ...
Unpacking replacement libsqlite3-0 ...
Selecting previously unselected package sqlite3.
Unpacking sqlite3 (from .../sqlite3_3.7.9-2ubuntu1_amd64.deb) ...
Processing triggers for man-db ...
Setting up libsqlite3-0 (3.7.9-2ubuntu1) ...
Setting up sqlite3 (3.7.9-2ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

xda@xda-dt:~$ sqlite3
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .exit
发布于:2019-11-13 11:40:28