Ubuntu18.04.1中安装gcc出现 “Command 'gcc' not found, but can be installed with: sudo apt install gcc”问题

Ubuntu18.04.1中安装gcc出现 “Command ‘gcc’ not found, but can be installed with: sudo apt install gcc”问题

Ubuntu18.04.1中安装gcc出现 “Command 'gcc' not found, but can be installed with: sudo apt install gcc”问题
输入sudo apt install gcc出现如下问题

Ubuntu18.04.1中安装gcc出现 “Command 'gcc' not found, but can be installed with: sudo apt install gcc”问题
分别输入

sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
Ubuntu18.04.1中安装gcc出现 “Command 'gcc' not found, but can be installed with: sudo apt install gcc”问题
重新输入sudo apt install gcc命令,这样就可以安装gcc了
Ubuntu18.04.1中安装gcc出现 “Command 'gcc' not found, but can be installed with: sudo apt install gcc”问题
验证gcc是否安装成功
可以输入gcc -v 命令,出现以下画面则安装成功。
Ubuntu18.04.1中安装gcc出现 “Command 'gcc' not found, but can be installed with: sudo apt install gcc”问题
参考链接:https://blog.csdn.net/m0_37442062/article/details/95446785