Ubuntu 一直要求依赖的错误

今天笔者在windows上装linux双系统,选用的ubuntu,因为第> 一次用,所以出现了这个问题。

如题,安装个gcc一直要求我要装依赖,如图
problem
接下来我又开始一个个安装那些依赖,比如 sudo apt-get install libc6-dev,然后又报依赖出错。

解决方法

这个问题出在了源的配置上,因为我装的源配置的系统版本代号出问题了。

  1. 查询系统版本代号

    lsb_release -a
    

    例:

    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 20.04.1 LTS
    Release:        20.04
    Codename:       focal
    

    这里的focal就是版本代号,记下或复制

  2. 看源列表
    打开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

  3. 调用命令打开配置包源的文件
    推荐先备份:

    sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
    

    调用命令打开配置包源的文件:

    sudo vim /etc/apt/sources.list
    
  4. 在vim操作文件

    • 按ggVG全选文本
    • 按键盘上的del全部删除
    • 按i进入编辑模式
    • 把上面改过的模板复制进去
    • 按键盘上的ESC
    • 输入:wq然后enter
  5. 输入以下指令

    sudo apt-get update
    
    sudo apt-get upgrade
    
posted @ 2020-12-01 19:59  Eritque-arcus  阅读(110)  评论(0)    收藏  举报