Ubuntu 一直要求依赖的错误
今天笔者在windows上装linux双系统,选用的ubuntu,因为第> 一次用,所以出现了这个问题。
如题,安装个gcc一直要求我要装依赖,如图

接下来我又开始一个个安装那些依赖,比如 sudo apt-get install libc6-dev,然后又报依赖出错。
解决方法
这个问题出在了源的配置上,因为我装的源配置的系统版本代号出问题了。
-
查询系统版本代号
lsb_release -a例:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal这里的focal就是版本代号,记下或复制
-
看源列表
打开https://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8
复制上面的模板
例:deb http://cn.archive.ubuntu.com/ubuntu/ willy main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ willy-security main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ willy-updates main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ willy-backports main restricted universe multiverse ##測試版源 deb http://cn.archive.ubuntu.com/ubuntu/ willy-proposed main restricted universe multiverse #源碼 deb-src http://cn.archive.ubuntu.com/ubuntu/ willy main restricted universe multiverse deb-src http://cn.archive.ubuntu.com/ubuntu/ willy-security main restricted universe multiverse deb-src http://cn.archive.ubuntu.com/ubuntu/ willy-updates main restricted universe multiverse deb-src http://cn.archive.ubuntu.com/ubuntu/ willy-backports main restricted universe multiverse ##測試版源 deb-src http://cn.archive.ubuntu.com/ubuntu/ willy-proposed main restricted universe multiverse接下来把里面的willy全部换成自己的版号,比如把全部willy换成focal
-
调用命令打开配置包源的文件
推荐先备份:sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup调用命令打开配置包源的文件:
sudo vim /etc/apt/sources.list -
在vim操作文件
- 按ggVG全选文本
- 按键盘上的del全部删除
- 按i进入编辑模式
- 把上面改过的模板复制进去
- 按键盘上的ESC
- 输入:wq然后enter
-
输入以下指令
sudo apt-get updatesudo apt-get upgrade
本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。

浙公网安备 33010602011771号