Ubuntu 一直要求依赖的错误

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

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

解决方法ubuntu

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

  1. 查询系统版本代号windows

    lsb_release -a

    例:bash

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

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

  2. 看源列表
    打开https://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8
    复制上面的模板
    例:spa

    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换成focalrest

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

    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
相关文章
相关标签/搜索