(1)卸载旧版本gcc
sudo apt-get remove gcc
(2)添加软件源
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
(3)更新
sudo apt-get update
(4)使用apt-cache policy gcc-9 获得gcc-9安装包

(5)安装指定版本gcc
sudo apt-get install aptitude
sudo aptitude install gcc-9=9.3.0-10ubuntu2

(6)查看gcc版本

网友评论