2012-03-07 148 views
1

我想在Ubuntu11.10上使用終端安裝OpenCV。但它給了我以下錯誤。我一直無法解決它。注意最後四行。在Ubuntu 11.10的opencv安裝

$sudo apt-get install opencv 
Reading package lists... Done 
Building dependency tree   
Reading state information... Done 
The following extra packages will be installed: 
libopencv2.3 
The following NEW packages will be installed: 
libopencv2.3 opencv 
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. 
Need to get 11.8 MB of archives. 
After this operation, 88.7 MB of additional disk space will be used. 
Do you want to continue [Y/n]? Y 
Get:1 http://ppa.launchpad.net/gijzelaar/opencv2.3/ubuntu/ oneiric/main libopencv2.3 i386 2.3.1-3 [11.5 MB] 
Get:2 http://ppa.launchpad.net/gijzelaar/opencv2.3/ubuntu/ oneiric/main opencv i386 2.3.1-3 [264 kB] 
Fetched 11.8 MB in 22s (528 kB/s)               
(Reading database ... 240623 files and directories currently installed.) 
Unpacking libopencv2.3 (from .../libopencv2.3_2.3.1-3_i386.deb) ...  
dpkg: error processing /var/cache/apt/archives/libopencv2.3_2.3.1-3_i386.deb (--unpack): 
trying to overwrite '/usr/lib/libopencv_highgui.so.2.3.1', which is also in package libopencv-highgui2.3 2.3.1-4ppa1  
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) 
Unpacking opencv (from .../opencv_2.3.1-3_i386.deb) ... 
dpkg: error processing /var/cache/apt/archives/opencv_2.3.1-3_i386.deb (--unpack): 
trying to overwrite '/usr/bin/opencv_createsamples', which is also in package libopencv-core-dev 2.3.1-4ppa1 
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) 
Errors were encountered while processing: 
/var/cache/apt/archives/libopencv2.3_2.3.1-3_i386.deb 
/var/cache/apt/archives/opencv_2.3.1-3_i386.deb 
E: Sub-process /usr/bin/dpkg returned an error code (1) 
$ 

回答

2

對於這樣的錯誤:

dpkg: error processing /var/cache/apt/archives/AAA (--unpack): 
trying to overwrite `/usr/lib/BBB', which is also in package CCC 
dpkg-deb: subprocess paste killed by signal (Broken pipe) 
Errors were encountered while processing: 
AAA 
E: Sub-process /usr/bin/dpkg returned an error code (1) 

(其中AAA,BBB,CCC是佔位符名稱,如果它是不明確)

sudo dpkg -i --force-overwrite AAA 

(給出AAA的完整路徑),然後運行

sudo apt-get -f install 

再次。

而且,在發佈問題前嘗試使用Google搜索,導致有大量鏈接解釋如何解決此錯誤!

+0

工作!謝謝。 – 2012-03-07 09:18:52

+0

@ chai.nadig YW!google下次...; D – Matteo 2012-03-07 09:19:25