【已解决】安装opencv过程中sudo apt-get install libgtk2.0-dev -y安装失败解决

本文介绍了在遇到`libgtk2.0-dev`安装失败,依赖未满足的问题时,如何通过修改apt源列表,解决raspbian系统中出现的包冲突。方法包括注释原有源并添加清华大学镜像源,然后更新源并重新安装所需包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误:

~ $ sudo apt-get install libgtk2.0-dev -y
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:
 libgtk2.0-dev : Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
                 Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决方法:

sudo nano /etc/apt/sources.list

将原文用#注释,添加以下两行:

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi

 输入以下代码:

sudo nano /etc/apt/sources.list.d/raspi.list

 将以下内容复制粘贴:

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

 

sudo apt-get update

 再次执行,即可成功:

sudo apt-get install libgtk2.0-dev -y

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值