当我试图在Geany中编译时,我会得到以下错误:
/bin/sh: 1: gcc: not found当我跑的时候
sudo apt install gcc这就是在屏幕上打印的内容:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc : Depends: gcc-7 (>= 7.3.0-12~) but it is not going to be installed
Recommends: libc6-dev but it is not going to be installed or
libc-dev
E: Unable to correct problems, you have held broken packages.我正在使用Ubuntu18.04.1 LTS
发布于 2018-11-03 15:21:08
维杰的评论解决了我的问题。谢谢你维杰。
答案是这里。
该特定错误消息可能表明您已持有包,但也可能表示存在不同的问题。
您可以通过以下方式获得实际持有的包的列表:
dpkg --get-selections | grep hold如果没有,或者看上去没有关联,那么它可能是其他的东西。仔细检查当您获得错误消息时尝试的命令的输出,因为除了错误消息之外,该命令的完整输出中可能还有其他线索。
另一种故障排除方法可能是使用智能,而不是使用apt-get来尝试安装软件包:
sudo aptitude install gcc智能将不那么容易放弃,并将试图找到解决方案,其中可能涉及修改其他软件包。它可能会给你更多的解释问题和解决它的选择。
偶尔,智能会太急于删除或降级大量包,以满足您的要求,在这种情况下,用-f重试会改变它的优先级,并帮助它想出解决方案,包括删除/降级更少的包,即使这意味着您所要求的所有更改都不能进行:
sudo aptitude -f install gcc最后两个选项解决了我的问题,我希望它也能帮助别人。
https://askubuntu.com/questions/1089719
复制相似问题