ubuntu 安装gcc 或g++ 时提示未发现软件包 gcc或g++

2023-05-16

问题:安装gcc 或g++ 时提示未发现软件包?

1.这时,只需更新apt-get即可,那么apt-get是什么呢?
apt-get,是一条linux命令,适用于deb包管理式的操作系统,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。

输入命令:sudo apt-get update

如果更新时出现卡顿或很慢,是由于我们用的是外网,或者我们电脑的网络过慢

对于前者我的建议是换源
2.什么原因造成的呢?
因为我们安装好ubuntu双系统\单系统后,默认的软件更新源是国外的,
我们可以打开源目录看看:
先切换到目录:
cd /etc/apt
查看/编辑目录:
sudo vi sources.list
我们可以发现:里面的源都是关于cn.archive.ubuntu.com
这个就是国外的软件更新源

3.怎么解决呢?
国外的软件更新源在国内使用速度很慢,需要更换成国内的源,这样才能正常安装和更新软件。

怎么更换呢?
打开终端命令行界面中,先将sources.list文件备份一个,更新源服务器地址就是存在这个文件里面的,所以主要就是对这个文件进行编辑就可以了,也是很简单的。

1.先切换到目录:cd /etc/apt

2.备份源(防止意外或后续需要)
输入:sudo cp sources.list sources.list.old

3.编辑源:sudo vim sources.list

4.将文件中内容全部删除

5.更换源,有一下几种源可以选择,推荐阿里云
(1)、阿里云

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

(2)、清华大学

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

(3)、中科大

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

6、复制其中一种粘贴完后,要对照一下,有没有粘贴格式的错误或缺了哪些东西,然后保存退出。最后别忘了更新缓存。
输入:sudo apt-get update
更新缓存需要一点时间,更新完就可以了。

执行sudo apt-get update后续出现的问题,如没出现请忽略:
如输入:sudo apt-get update后出现这些信息

W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Unknown Multi-Arch type 'no' for package 'libxapian-dev'
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-min
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'kwin'
W: Unknown Multi-Arch type 'no' for package 'kwin-dev'
W: Unknown Multi-Arch type 'no' for package 'kwin-wayland'
W: Unknown Multi-Arch type 'no' for package 'kwin-x11'
W: Unknown Multi-Arch type 'no' for package 'libkf5sysguard-dev'
W: Ignoring Provides line with DepCompareOp for package php-psr-http-message-implementation
W: Ignoring Provides line with DepCompareOp for package php-psr-log-implementation
W: Ignoring Provides line with DepCompareOp for package php-seclib
W: Ignoring Provides line with DepCompareOp for package php-sabre-http
W: Ignoring Provides line with DepCompareOp for package php-math-biginteger
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Unknown Multi-Arch type 'no' for package 'libxapian-dev'
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-min
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'kwin-dev'
W: Unknown Multi-Arch type 'no' for package 'kwin-wayland'
W: Unknown Multi-Arch type 'no' for package 'kwin-x11'
W: Unknown Multi-Arch type 'no' for package 'libkf5sysguard-dev'
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Ignoring Provides line with DepCompareOp for package xserver-xorg
W: Ignoring Provides line with DepCompareOp for package php-math-biginteger
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Ignoring Provides line with DepCompareOp for package xserver-xorg
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min

W: 您可能需要运行 apt-get update 来解决这些问题
怎么办呢?

执行如下命令:sudo apt-get install -f apt

再次输入:sudo apt-get update
OK,问题解决

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu 安装gcc 或g++ 时提示未发现软件包 gcc或g++ 的相关文章

随机推荐

  • VSCode插件 优雅地使用Jupyter Notebook

    VSCode插件 优雅地使用Jupyter Notebook 环境 Python 3 7 4 conda 4 7 12 jupyter notebook 6 0 1 要求需要有Python环境和Anaconda环境 安装了jupyter n
  • pymssql连接mssql错误:pymssql.OperationalError: (20009, b‘DB-Lib error message 20009, severity 9:\

    pymssql连接mssql错误 xff1a pymssql OperationalError 20009 b DB Lib error message 20009 severity 9 打开SQL Server Configuration
  • 基于有道翻译的英翻中微信小程序

    基于有道翻译的英翻中微信小程序 环境 微信开发者工具 微信小程序云开发 node js v12 16 3 axios 64 0 20 0 cheerio 64 1 0 0 rc 3 相关内容 Node js有道翻译爬虫 客户端 创建新的微信
  • PaddleHub OCR实现文字识别

    PaddleHub OCR实现文字识别 环境 paddlehub 61 61 1 8 3 paddleocr 61 61 1 0 1 paddlepaddle 61 61 1 8 5 Shapely 61 61 1 7 1 pip安装 pi
  • IDEA连接远程MongoDB数据库

    IDEA连接远程MongoDB数据库 环境 IntelliJ IDEA 2020 2 3 Ultimate Edition MongDB 4 2 1 阿里云MongoDB控制台 进入阿里云控制台 xff0c 选择MongDB实例列表 xff
  • 开发常用网站

    开发常用网站 开发工具 JetBrains VSCode SublimeText Web开发 微信小程序开发者文档 Node js boostrap HTML HTTP服务器 Nginx Tomcat Apache HTTP Server
  • 使用Idea创建项目的一种清晰思路

    1 打开Idea后 xff0c 选择File gt new gt project 2 选择空项目 3 将project命名为任意名称 xff0c 这里命名为Java Exercise xff0c 点Finish 4 弹出对话框 xff0c
  • Spring Boot搭建Web项目(MongoDB)

    Spring Boot搭建Web项目 环境 JDK 1 8 IntelliJ IDEA 2020 3 2 Ultimate Edition PyCharm 2020 2 4 Professional Edition Maven 3 6 bs
  • 银行家算法 C++描述

    银行家算法 C 43 43 描述 银行家算法 操作系统 银行家算法 实现代码 main cpp span class token macro property span class token directive keyword inclu
  • 三种修改windows系统MAC地址方法

    方法一 xff1a 使用windows控制面板修改 第一步 按win键 gt 输入 控制面板 并打开 第二步 打开 网络和共享中心 第三步 打开 更改适配器设置 第四步 右击 WLAN2 后点击属性 第五步 修改网络地址属性 点击配置 xf
  • 【操作系统实验】Linux环境下用进程实现生产者消费者问题——C语言完整代码+详细实验报告

    注意 代码在文末 xff0c 以下为详细实验报告 实验目的 以生产者和消费者问题为例 xff0c 学习并熟悉Linux下进程通信 同步机制的具体实现方法 xff0c 主要是了解并掌握信号量机制和共享内存的使用方法 xff0c 进一步熟悉Li
  • mariadb的源码安装

    xff08 1 xff09 登上mariadb的官方网站 2 选择下载mariadb server 3 下载10 2版本 4 找到源码安装方式 xff08 5 xff09 下载传输到主机上 6 准备编译环境 yum span class t
  • HTTP协议以及Apache的httpd配置

    HTTP协议 前言HTTP简介HTTP诞生HTTP版本历史HTTP 0 9HTTP 1 0HTTP 1 1HTTP 2 0 web资源HTTP工作流程HTTP报文报文语法格式method xff08 方法 xff09 status xff0
  • 狂神说Redis笔记,Redis【入门】就这一篇就够了!

    Redis学习笔记 视频链接 xff1a 狂神说Redis链接 1 Nosql概述 1 1 为什么要使用Nosql 1 单片机Mysql时代 90年代 xff0c 一个网站的访问量太大 xff0c 单个数据库完全够用 随着用户的增多 xff
  • manjaro一些常用软件,指令(持续更新中)

    manjaro使用很久了 xff0c 由于对linux的陌生和迷惑 xff0c 重装了很多很多很多次 xff0c 最近的系统大概是使用最久的一次 xff0c 也解决了很多以前的问题在此记录下 系统如下 xff1a 软件安装 换源 烂大街的教
  • 在开发板上安装gdb

    网上对于在开发板上安装gdb的教程大多都是将开发板的文件系统放在虚拟机主机上 xff0c 从而通过nfs挂载上去的 xff0c 主要是针对性能较差开发板 xff0c 本教程讲解的是如何在开发板上直接安装gdb 为什么不能直接将pc上交叉编译
  • Idea Intellij 远程开发调试

    一 背景 在构建MiniOB开发环境时需要Linux环境 xff0c 另外结合分布式系统 xff0c 利用较好的通信 xff0c 萌发了远程开发的想法 xff1b 实际上远程部署 开发在很久之前有过想法 xff08 大约刚开始学Spring
  • Java笔记(4)——方法重载和this关键字

    1 方法的重载 不能通过参数名去区分两个方法 不能通过返回值类型来区分两个方法 可以通过参数列表 xff1a 参数个数 xff0c 参数类型来区分 span class token keyword public span span clas
  • 基于 java+springboot 工资管理系统设计和实现

    博主介绍 xff1a 5年java开发经验 xff0c 专注Java开发 定制 远程 指导等 csdn特邀作者 专注于Java技术领域 作者主页 超级帅帅吴 Java项目精品实战案例 500套 欢迎点赞 收藏 留言 文末获取源码联系方式 目
  • ubuntu 安装gcc 或g++ 时提示未发现软件包 gcc或g++

    问题 xff1a 安装gcc 或g 43 43 时提示未发现软件包 xff1f 1 这时 xff0c 只需更新apt get即可 xff0c 那么apt get是什么呢 xff1f apt get xff0c 是一条linux命令 xff0