1. 程式人生 > >Ubuntu遇到版本不對導致依賴不對應問題的解決方案

Ubuntu遇到版本不對導致依賴不對應問題的解決方案

libssl-dev版本問題無法安裝 : Depends: libssl1.0.0 (= 1.0.1t-1+deb7u2) but 1.0.1t-1+deb8u6 is to be installed

 

 

 

問題現象:

在安裝libssl-dev 的時候提示錯誤:

sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1t-1+deb7u2) but 1.0.1t-1+deb8u6 is to be installed
              Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

 

 

解決方法:

linux的版本依賴問題很令人糾結,不過我們可以通過使用aptitude軟體包管理器來解決這個依賴問題,aptitude是可以選擇合適的版本與匹配軟體安裝。

首先安裝aptitude工具

 

sudo apt-get install aptitude

再利用aptitude來安裝libssl-dev

 

sudo aptitude install libssl-dev
The following NEW packages will be installed:
  libssl-dev{b} libssl-doc{a} 
0 packages upgraded, 2 newly installed, 0 to remove and 12 not upgraded.
Need to get 2,755 kB of archives. After unpacking 6,426 kB will be used.
The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1t-1+deb7u2) but 1.0.1t-1+deb8u6 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libssl-dev [Not Installed]                         



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

     Downgrade the following packages:                                      
1)     libssl1.0.0 [1.0.1t-1+deb8u6 (now) -> 1.0.1t-1+deb7u2 (oldoldstable)]



Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libssl1.0.0 
The following NEW packages will be installed:
  libssl-dev libssl-doc{a} 
0 packages upgraded, 2 newly installed, 1 downgraded, 0 to remove and 12 not upgraded.
Need to get 3,825 kB of archives. After unpacking 6,420 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://mirrors.aliyun.com/raspbian/raspbian/ wheezy/main libssl1.0.0 armhf 1.0.1t-1+deb7u2 [1,070 kB]
Get: 2 http://mirrors.aliyun.com/raspbian/raspbian/ wheezy/main libssl-dev armhf 1.0.1t-1+deb7u2 [1,528 kB]
Get: 3 http://mirrors.aliyun.com/raspbian/raspbian/ wheezy/main libssl-doc all 1.0.1t-1+deb7u2 [1,227 kB]
Fetched 3,825 kB in 5s (753 kB/s)     
Preconfiguring packages ...
dpkg: warning: downgrading libssl1.0.0:armhf from 1.0.1t-1+deb8u6 to 1.0.1t-1+deb7u2
(Reading database ... 115760 files and directories currently installed.)
Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb7u2_armhf.deb ...
Unpacking libssl1.0.0:armhf (1.0.1t-1+deb7u2) over (1.0.1t-1+deb8u6) ...
Selecting previously unselected package libssl-dev.
Preparing to unpack .../libssl-dev_1.0.1t-1+deb7u2_armhf.deb ...
Unpacking libssl-dev (1.0.1t-1+deb7u2) ...
Selecting previously unselected package libssl-doc.
Preparing to unpack .../libssl-doc_1.0.1t-1+deb7u2_all.deb ...
Unpacking libssl-doc (1.0.1t-1+deb7u2) ...
Processing triggers for man-db (2.7.5-1~bpo8+1) ...
Setting up libssl1.0.0:armhf (1.0.1t-1+deb7u2) ...
Setting up libssl-dev (1.0.1t-1+deb7u2) ...
Setting up libssl-doc (1.0.1t-1+deb7u2) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...

至此,問題解決,以後遇到版本不對導致依賴不對應的問題也可以採用上述的方法進行解決。

 

參考地址:http://blog.csdn.net/andy812110/article/details/24842219