我想在 Ubuntu 22.04 上安装 gcc-7。
我用了:
sudo apt-get install gcc-7 g++-7
但出现错误:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package g++-7 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package gcc-7 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'gcc-7' has no installation candidate
E: Package 'g++-7' has no installation can
我怎样才能将它安装到我的机器上?
亲切的问候
迪达泰
答案1
感谢@Knud Larsen 提供的解决方案。
我遇到了同样的问题,我需要旧版本的 distcc 服务器。客户端系统,一台弱小的工业 PC,无法更新。
因此解决方案很简单,我没有想到,但它确实有效。为了记录,我添加了:
deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe
到 /etc/apt/sources.list 和
跑:apt update; apt install g++-7
答案2
我建议使用 进行安装gcc-7
。brew
这样,它就不会永久添加到您的系统中,您可以在不再需要它时将其删除。
赶紧跑brew install gcc@7
但是,请勿使用 BREW 进行任何需要管理员权限的操作。它不会起作用。