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)

相关推荐
NiNg_1_23424 分钟前
使用Docker Compose一键部署
运维·docker·容器
萠哥啥都行29 分钟前
Linux安装Docker以及Docker入门操作
运维·docker·容器
王哲晓30 分钟前
Linux通过yum安装Docker
java·linux·docker
OkeyProxy33 分钟前
怎麼在Ubuntu上設置全局代理
ubuntu·代理模式·proxy模式·ip代理·海外ip代理
小江湖199435 分钟前
元数据保护者,Caesium压缩不丢重要信息
运维·学习·软件需求·改行学it
gopher951143 分钟前
linux驱动开发-中断子系统
linux·运维·驱动开发
码哝小鱼1 小时前
firewalld封禁IP或IP段
linux·网络
鼠鼠龙年发大财1 小时前
【x**3专享】安装SSH、XFTP、XShell、ARM Linux
linux·arm开发·ssh
nfgo1 小时前
快速体验Linux发行版:DistroSea详解与操作指南
linux·ubuntu·centos
吃面不喝汤662 小时前
如何配置和使用自己的私有 Docker Registry
运维·docker·容器