杨凌做网站的,九年级上册信息技术做网站,广告公司网站,喜欢做网站的行业最近遇到一些问题#xff0c;需要用到gcc-9/g-9#xff0c;但是我自带的ubuntu18.04是gcc-7.5/g-7.5#xff0c;所以升级一下#xff0c;奈何文章太多而且很多无效#xff0c;所以在此记录一下#xff1a; 参考#xff1a;https://stackoverflow.com/questions/19836858…最近遇到一些问题需要用到gcc-9/g-9但是我自带的ubuntu18.04是gcc-7.5/g-7.5所以升级一下奈何文章太多而且很多无效所以在此记录一下 参考https://stackoverflow.com/questions/19836858/upgrade-gcc-4-6-3-on-ubuntu-12-04-to-4-8-2 update-alternatives 是一个用于管理 Linux 系统中多个软件版本之间的符号链接的工具。它允许用户在多个安装的软件版本之间进行切换使得系统可以轻松地在不同版本之间切换而无需手动更改符号链接。 # 1. Add the ppa by
sudo add-apt-repository ppa:ubuntu-toolchain-r/test# 2. Install g and gcc (version 4.8)我安装的9版本根据你实际的来
# sudo apt-get update; sudo apt-get install gcc-4.8 g-4.8
sudo apt-get update; sudo apt-get install gcc-9 g-9# 3. Run the following commands one by one,
# 移除掉原有的所有管理器管理的版本 没有可以跳过
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g
# 设置新的版本管理
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 20
sudo update-alternatives --install /usr/bin/g g /usr/bin/g-9 20
# 更新管理器
sudo update-alternatives --config gcc
sudo update-alternatives --config ggcc -v # 9.0输出
g -v # 9.0输出如果你在第一步遇到
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Kylin/kylin说明你可能是双系统或者多系统或者自己安装了什么软件把系统发行版本改了需要修改回来
sudo gedit /etc/lsb-release# 粘贴到你的这个文件中去具体的最后一行描述可以根据uname -a来看
DISTRIB_IDUbuntu
DISTRIB_RELEASE18.04
DISTRIB_CODENAMEbionic
DISTRIB_DESCRIPTIONUbuntu 18.04.1 LTS