我尝试在 Ubuntu 16.04.3 上安装 gfortran,sudo apt install gfortran
但收到以下错误消息:
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: gfortran :
Depends: gfortran-5 (>= 5.3.1-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我尝试过 apt、aptitude、清理、更新、升级和修复潜在的损坏依赖项,但都无济于事。我希望用另一种方式来诊断这个问题。
答案1
您的 Ubuntu 16.04.3 已经很长时间没有更新了,因此在尝试修复损坏的软件包之前,您应该进行软件更新。
sudo apt update
sudo apt upgrade
选择修复损坏的软件包Synaptic 软件包管理器中的选项。这是一个针对损坏软件包错误消息的 GUI 解决方案,操作简单。
运行以下命令安装 Synaptic。
sudo apt update
sudo apt install synaptic
打开 Synaptic 并在 Synaptic 中选择编辑->修复损坏的软件包然后重复编辑->修复损坏的软件包第二次。
另一个简单的解决方法是从默认的 Ubuntu 16.04 存储库安装旧版本的 gfortran,而不是语言当前版本为 5.3.1 的软件包。打开终端并输入:
sudo apt update
sudo apt install gfortran-4.8