ubuntu : 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

往后看,90%能解决你的问题

原文链接:学一下 (suxueit.com)

我相信很多人刚使用ubuntu都遇到过这个问题,如果没有遇到,可能是你运气好使用了正确的软件源

复制代码
 libprotobuf-dev : 依赖: zlib1g-dev 但是它将不会被安装
zlib1g-dev : 依赖: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) 但是 1:1.2.8.dfsg-2ubuntu4.1 已安装。
# 等待一些列的报错问题

思考问题

你肯定看到过

  • 使用aptitude解决的方法: 为什么要用aptitude呢,难道ubuntu默认的apt是垃圾,解决不了这个问题了?

    复制代码
    Sudo aptitude install 需要安装的软件名
  • 也肯定看到过让你换一个阿里源的解决办法: 为啥要换源呢,不换就不行了?

    复制代码
    deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

解决问题

ubuntu自带的apt肯定是能解决的

apt安装的时候会去配置的软件源找包,并查看相关依赖

所以只要源配置正确了,基本就不会出现这种依赖错误的问题

什么样的源是正确的呢,网上只有让换阿里源,或者其他源的,且没有告诉你源应该保持和自己系统的版本一致【或者说CodeName一致】

查看CodeName

复制代码
lsb_release -c

找到对应codeName的源【例如我的是 jammy】

复制代码
deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

详细的CodeName源

ubuntu镜像_ubuntu下载地址_ubuntu安装教程-阿里巴巴开源镜像站 (aliyun.com)

相关推荐
心随_风动3 分钟前
RHEL与CentOS:从同源到分流的开源操作系统演进
linux·开源·centos
ALex_zry11 分钟前
跨Linux发行版CPU指令集兼容性深度解析与实践指南
linux·运维·服务器
特立独行的猫a27 分钟前
redis客户端库redis++在嵌入式Linux下的交叉编译及使用
linux·数据库·c++·redis·redis客户端库
无敌小茶1 小时前
Linux学习笔记之环境变量
linux·笔记
Harbor Lau1 小时前
Linux常用中间件命令大全
linux·运维·中间件
漫谈网络1 小时前
基于 Netmiko 的网络设备自动化操作
运维·自动化·netdevops·netmiko
꧁坚持很酷꧂2 小时前
Linux Ubuntu18.04下安装Qt Craeator 5.12.9(图文详解)
linux·运维·qt
凉、介2 小时前
PCI 总线学习笔记(五)
android·linux·笔记·学习·pcie·pci
电鱼智能的电小鱼3 小时前
EFISH-SBC-RK3588无人机地面基准站项目
linux·网络·嵌入式硬件·机器人·无人机·边缘计算
foo1st3 小时前
Tomcat Web应用(Ubuntu 18.04.6 LTS)部署笔记
ubuntu·tomcat