ubuntu 14.04更新GCC版本
按最基本的apt-get install gcc-8,不成功,提示如下。
按网上说的:apt-get update ,apt-get upgrade 后都无效果。
apt-cache search get 搜索后,发现资源链接里最新的也只有4.8.4所以不行。
需要更新资源链接,镜像地址。
1.替换软件更新源方法:
ubuntu 安装gcc 或g++ 时提示未发现软件包 gcc或g++_无法定位软件包gcc_只是个~小不点的博客-CSDN博客 2. 添加软件源方法
https://wenku.csdn.net/answer/881c213342fe46979aaba123b7ebbcf5
命令:sudo add-apt-repository ppa:ubuntu-toolchain-r/test来添加源,然后使用 sudo apt-get update命令来更新软件源。最后使用 sudo apt-get install gcc-8来安装。
3.使用update-alternatives指定GCC默认版本
https://blog.csdn.net/Nirvana15/article/details/122317525?spm=1001.2014.3001.5502
4.更新阿里云软件源也没有解决。最后用2中PPA的软件源安装成功。
1.
问题:安装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,问题解决
3.选择GCC默认版本
#############切换gcc/g++版本##############
gcc -v
g++ -v
查看系统已有版本
ls /usr/bin/gcc*
ls /usr/bin/g++*
安装
sudo apt install gcc-4.9
sudo apt install g++-4.9# 安装 gcc-7 / g++-7
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-7
sudo apt-get install g++-7切换
先将需要的版本添加到 update-alternatives 中
# gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70# g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 40
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 70
若想删除,执行命令:sudo update-alternatives --remove gcc /usr/bin/gcc-4.9
手动配置 update-alternatives
sudo update-alternatives --config gcc
sudo update-alternatives --config g++输入版本编号
1、sudo apt-get remove gcc-*
sudo apt-get remove g++-* 卸载
2、sudo apt-get install gcc-*
sudo apt-get install g++-* 安装
3、 ls /usr/bin/gcc* -l 查询安装的gcc以及默认指向版本
4、修改默认的gcc和g++版本
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-* 40(*指某一版本,40代表优先级)
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-* 40 (*指某一版本,40代表优先级)
配置默认的gcc和g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
5、gcc--version 查询gcc版本
g++--version 查询g++版本
相关文章:

ubuntu 14.04更新GCC版本
按最基本的apt-get install gcc-8,不成功,提示如下。 按网上说的:apt-get update ,apt-get upgrade 后都无效果。 apt-cache search get 搜索后,发现资源链接里最新的也只有4.8.4所以不行。 需要更新资源链接,镜像地…...
AndroidUtil - 强大易用的安卓工具类库
官网 https://github.com/Blankj/AndroidUtilCode/blob/master/README-CN.md 项目介绍 AndroidUtilCode 🔥 是一个强大易用的安卓工具类库,它合理地封装了安卓开发中常用的函数,具有完善的 Demo 和单元测试,利用其封装好的 API…...
[多态设计模式]枚举
背景: 游戏服务器中,多态可以说体现的淋漓尽致。 如: 1.开启条件。有的系统是根据玩家等级,有的是根据通关第几关。 2.商店可能有不同类型的商店。 3.任务系统中,不同的计数类型,不同的任务目标类型。…...

【QT】QRadioButton的使用(17)
QRadioButton这个控件在实际项目中多用于多个QRadioButton控件选择其中一个这样的方式去执行,那么,今天这节就通过几个简单的例子来好好了解下QRadioButton的一个使用。 一.环境配置 1.python 3.7.8 可直接进入官网下载安装:Download Pyt…...

力扣:105. 从前序与中序遍历序列构造二叉树(Python3)
题目: 给定两个整数数组 preorder 和 inorder ,其中 preorder 是二叉树的先序遍历, inorder 是同一棵树的中序遍历,请构造二叉树并返回其根节点。 来源:力扣(LeetCode) 链接:力扣&am…...
【含java2023面试题】HashMap、HashTable、ConcurrentHashMap
作为Java中最常用的Map集合,HashMap、HashTable和ConcurrentHashMap都是线程安全的,但它们之间有什么区别呢?在本文中,我们将深入探讨这三种Map集合的区别,并通过Java代码示例来演示它们之间的差异。 AI绘画关于SD,MJ…...

AT24C02芯片
AT24C02简介: AT24C01/02/04/08/16...是一个 1K/2K/4K/8K/16K 位串行 CMOS内部有9个字节; 该器件通过 I2C 总线接口进行 操作,它有一个专门的写保护功能; 基于51 他有这个芯片操作 时序: AT24C02软件编程: …...

Python+Django前后端分离
程序示例精选 PythonDjango前后端分离 如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助! 前言 这篇博客针对《PythonDjango前后端分离》编写代码,代码整洁,规则,易读。 学习与应…...

win11系统固定到快速访问的文件夹无法调整顺序的问题
最近在使用win11系统时,固定到快速访问的文件夹无法调整顺序。网上搜了一大圈没有对应的解决方法,柳暗花明,在博主yin0hao的一篇文章中找到了类似的,跟着做了一下,结果问题也解决了。在此记录。 在文件资源管理器地址…...

短视频矩阵系统,短视频矩阵源码技术开发
开发短视频矩阵系统的源码需要以下步骤: 确定系统需求:根据客户的需求,确定系统的功能和特点,例如用户注册登录、视频上传、视频浏览、评论点赞等。 设计系统架构:根据系统需求,设计系统的整体架构&#x…...

Flask 数据库 连接池、DBUtils、http 连接池
1、DBUtils 简介、使用 DBUtils 简介 DBUtils 是一套用于管理 数据库 "连接池" 的Python包,为 "高频度、高并发" 的数据库访问提供更好的性能,可以自动管理连接对象的创建和释放。并允许对非线程安全的数据库接口进行线程安全包装…...

Day 01 python学习笔记
1、引入 让我们先写第一个python程序(如果是纯小白的话) 因为我们之前安装了python解释器 所以我们直接win r ---->输入cmd(打开运行终端) >python #(在终端中打开python解释器)>>>pri…...
CSharp Library develop histroy
1. .NET FRAMEWORK 发展版本 版本 完整版本号 发行日期 Visual Studio Windows 默认安装 1.0 1.0.3705.0 2002-02-13 Visual Studio .NET 2002 Windows XP Media Center Edition Windows XP Tablet PC Edition 1.1 1.1.4322.573 2003-04-24 Visual Studio .NET 2…...

林木种苗生产vr虚拟实训教学降低培训等待周期
林业种植管理在保护水土流失、气候变化及经济社会发展中发挥重要的作用,林业教学往往需要进入林区进行实操察验,在安全性、时间及效率上难以把控,因此有更多林业畜牧院校创新性地引进VR虚拟现实技术。 在林业领域,实地调查是获取准…...

LabVIEW在运行时调整表控件列宽
LabVIEW在运行时调整表控件列宽 如何在LabIEW中运行时调整表控件的列宽大小? 在VI运行时,有两种不同的方法可以更改表中列的宽度。首先,可以使用鼠标手动更改它们;其次,可以从框图中以编程方式更改它们。 手动更改列宽 只有在…...
【6 ElementUI Tabs控件第二个tab页签Div宽度缩小的问题】
背景 在使用ElementUI的Tabs 控件时,发现第二个tabs 内容的Div宽度用的百分比,然后就会缩小,导致内容变形,这边的处理方法就是拿到一个tabs 内容的div的offsetWidth,然后将这个width赋值给第二个Div的width即可。 代…...

读写分离MySQL
利用Mycat控制后台数据库的读写分离和负载均衡 利用主从复制思想,实现读写分离,主库写,从库读 从库最好不要写,因为从库写入的数据不能同步到主库,只有主库写的数据才能同步到从库 balance属性值对应的含义(负载均衡) 一主一从读写分离的弊端 主节点Master宕机以后,业务系统…...

MySQL数据库用户管理
MySQL数据库用户管理 1、数据库权限1.1什么是数据库权限1.2数据库权限分类1.3用户管理 2、用户授权2.1grant提权2.2查看权限2.3撤销权限 3、修改密码3.1修改当前用户密码3.2修改其他用户密码3.3修改root密码 4、远程登录4.1远程登录4.2软件远程登录 5、总结 1、数据库权限 1.1…...
package.json属性
添加链接描述 一、必须属性 name 定义项目的名称,不能以".“和”_"开头,不能包含大写字母version 定义项目的版本号,格式为:大版本号.次版本号.修订号 二、描述信息 description 项目描述keywords 项目关键词author …...
C# 把m4a格式文件转为MP3格式
直接上代码: 先引用 using NAudio.Wave; using NAudio.Lame; 1, 文件列表来自于根目录里所有的m4a文件 string directloc "G:\mp3\MP3"; string[] fyles Directory.GetFiles(directloc); NAudio.Wave.BlockAlignReductionStream stream …...

Docker 离线安装指南
参考文章 1、确认操作系统类型及内核版本 Docker依赖于Linux内核的一些特性,不同版本的Docker对内核版本有不同要求。例如,Docker 17.06及之后的版本通常需要Linux内核3.10及以上版本,Docker17.09及更高版本对应Linux内核4.9.x及更高版本。…...

页面渲染流程与性能优化
页面渲染流程与性能优化详解(完整版) 一、现代浏览器渲染流程(详细说明) 1. 构建DOM树 浏览器接收到HTML文档后,会逐步解析并构建DOM(Document Object Model)树。具体过程如下: (…...

ElasticSearch搜索引擎之倒排索引及其底层算法
文章目录 一、搜索引擎1、什么是搜索引擎?2、搜索引擎的分类3、常用的搜索引擎4、搜索引擎的特点二、倒排索引1、简介2、为什么倒排索引不用B+树1.创建时间长,文件大。2.其次,树深,IO次数可怕。3.索引可能会失效。4.精准度差。三. 倒排索引四、算法1、Term Index的算法2、 …...
CRMEB 框架中 PHP 上传扩展开发:涵盖本地上传及阿里云 OSS、腾讯云 COS、七牛云
目前已有本地上传、阿里云OSS上传、腾讯云COS上传、七牛云上传扩展 扩展入口文件 文件目录 crmeb\services\upload\Upload.php namespace crmeb\services\upload;use crmeb\basic\BaseManager; use think\facade\Config;/*** Class Upload* package crmeb\services\upload* …...

云原生玩法三问:构建自定义开发环境
云原生玩法三问:构建自定义开发环境 引言 临时运维一个古董项目,无文档,无环境,无交接人,俗称三无。 运行设备的环境老,本地环境版本高,ssh不过去。正好最近对 腾讯出品的云原生 cnb 感兴趣&…...

Linux nano命令的基本使用
参考资料 GNU nanoを使いこなすnano基础 目录 一. 简介二. 文件打开2.1 普通方式打开文件2.2 只读方式打开文件 三. 文件查看3.1 打开文件时,显示行号3.2 翻页查看 四. 文件编辑4.1 Ctrl K 复制 和 Ctrl U 粘贴4.2 Alt/Esc U 撤回 五. 文件保存与退出5.1 Ctrl …...
django blank 与 null的区别
1.blank blank控制表单验证时是否允许字段为空 2.null null控制数据库层面是否为空 但是,要注意以下几点: Django的表单验证与null无关:null参数控制的是数据库层面字段是否可以为NULL,而blank参数控制的是Django表单验证时字…...
嵌入式常见 CPU 架构
架构类型架构厂商芯片厂商典型芯片特点与应用场景PICRISC (8/16 位)MicrochipMicrochipPIC16F877A、PIC18F4550简化指令集,单周期执行;低功耗、CIP 独立外设;用于家电、小电机控制、安防面板等嵌入式场景8051CISC (8 位)Intel(原始…...
验证redis数据结构
一、功能验证 1.验证redis的数据结构(如字符串、列表、哈希、集合、有序集合等)是否按照预期工作。 2、常见的数据结构验证方法: ①字符串(string) 测试基本操作 set、get、incr、decr 验证字符串的长度和内容是否正…...
简单介绍C++中 string与wstring
在C中,string和wstring是两种用于处理不同字符编码的字符串类型,分别基于char和wchar_t字符类型。以下是它们的详细说明和对比: 1. 基础定义 string 类型:std::string 字符类型:char(通常为8位)…...