道阻且长,行则将至。埋头苦干,不鸣则已,一鸣惊人!加油,骚年!
1 问题描述
我按照此教程:为树莓派更换国内镜像源,更换树莓派镜像源为国内的 清华源 后,在使用 sudo apt-get install aptitude 时,出现依赖包错误的问题,具体错误信息如下:
pi@raspberrypi:~ $ sudo apt-get install aptitude 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: aptitude : Depends: libapt-pkg5.0 (>= 1.1) but it is not going to be installed Recommends: libparse-debianchangelog-perl but it is not going to be installed E: Unable to correct problems, you have held broken packages.
当出现此错误的时候,我也是找了很久,还去论坛上发帖求助(论坛传送门:树莓派更换清华源,安装aptitude报错),但是都没有得到有用的答案。
2 问题原因
3 问题解决
首先我使用命令: lsb_release -a ,查看当前树莓派系统版本,具体信息如下,此版本的代号为 “buster”
pi@raspberrypi:~ $ lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 10 (buster) Release: 10 Codename: buster
然后我去看了一下使用镜像源的地址,使用的版本代号为 “stretch” ,如下
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

于是,我去对应文件,把 stretch 修改为 buster ,大功告成✌️✌️✌️!
修改完毕后,记得执行如下命令,更新软件源列表!
sudo apt-get update sudo apt-get upgrade
此时,应该会有很多东西需要更新,慢慢等待即可,国内镜像源网速还是挺好的;
更新完毕之后,即可再次安装 aptitude ,使用如下命令:
sudo apt-get install aptitude
大功告成✌️✌️✌️,我终于解决了这个该死的问题,希望对你有所帮助!
4 总结
- 在使用国内镜像源时,一定要把版本号对应上,不能我的系统是 A 版本,给他一个 B 版本的镜像源,那他去更新下来的软件源列表,就很有可能会有问题,因为版本不匹配呀!
- 切记切记!!!
如果文章内容有误,麻烦评论/私信多多指教,谢谢!如果觉得文章内容还不错,记得一键三连哦(点赞、收藏、留言),您的支持就是对我最大的鼓励,谢谢您嘞!
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/199038.html原文链接:https://javaforall.net
