ubuntu 18.04 上未安装 gcc

ubuntu 18.04 上未安装 gcc

尝试使用以下命令安装 gcc:

raihan@raihan-home:~$ sudo apt install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
The following packages were automatically installed and are no longer required:
  libmysqlclient20 python-cryptodome python-olefile python-pil python-simplejson
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

raihan@raihan-home:~$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version (4:7.4.0-1ubuntu2.3).
The following packages were automatically installed and are no longer required:
  libmysqlclient20 python-cryptodome python-olefile python-pil python-simplejson
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

但是当我运行 gcc --version 它说没有安装

raihan@raihan-home:~$ gcc --version

Command 'gcc' not found, but can be installed with:

sudo apt install gcc

它还显示我已经安装了 gcc

raihan@raihan-home:~$ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root     16 May 17 12:45 /usr/bin/gcc -> /usr/bin/gcc-4.7
-rwxr-xr-x 1 root root 907648 Apr 12  2018 /usr/bin/gcc-5
lrwxrwxrwx 1 root root     22 Dec  4 20:25 /usr/bin/gcc-7 -> x86_64-linux-gnu-gcc-7
lrwxrwxrwx 1 root root      8 May 20  2019 /usr/bin/gcc-ar -> gcc-ar-7
-rwxr-xr-x 1 root root  31264 Apr 12  2018 /usr/bin/gcc-ar-5
lrwxrwxrwx 1 root root     25 Dec  4 20:25 /usr/bin/gcc-ar-7 -> x86_64-linux-gnu-gcc-ar-7
lrwxrwxrwx 1 root root      8 May 20  2019 /usr/bin/gcc-nm -> gcc-nm-7
-rwxr-xr-x 1 root root  31264 Apr 12  2018 /usr/bin/gcc-nm-5
lrwxrwxrwx 1 root root     25 Dec  4 20:25 /usr/bin/gcc-nm-7 -> x86_64-linux-gnu-gcc-nm-7
lrwxrwxrwx 1 root root     12 May 20  2019 /usr/bin/gcc-ranlib -> gcc-ranlib-7
-rwxr-xr-x 1 root root  31264 Apr 12  2018 /usr/bin/gcc-ranlib-5
lrwxrwxrwx 1 root root     29 Dec  4 20:25 /usr/bin/gcc-ranlib-7 -> x86_64-linux-gnu-gcc-ranlib-7

请帮我解决一下情况

相关内容