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)

相关推荐
Johny_Zhao2 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
小毛驴8503 小时前
Linux 后台启动java jar 程序 nohup java -jar
java·linux·jar
一心0924 小时前
ubuntu 20.04.6 sudo 源码包在线升级到1.9.17p1
运维·ubuntu·sudo·漏洞升级
好好学习啊天天向上4 小时前
世上最全:ubuntu 上及天河超算上源码编译llvm遇到的坑,cmake,ninja完整过程
linux·运维·ubuntu·自动性能优化
你想考研啊4 小时前
三、jenkins使用tomcat部署项目
运维·tomcat·jenkins
tan180°5 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
代码老y5 小时前
Docker:容器化技术的基石与实践指南
运维·docker·容器
典学长编程5 小时前
Linux操作系统从入门到精通!第二天(命令行)
linux·运维·chrome
wuk9986 小时前
基于MATLAB编制的锂离子电池伪二维模型
linux·windows·github
你想考研啊8 小时前
四、jenkins自动构建和设置邮箱
运维·jenkins