我想通过在终端中输入来在我的 Ubuntu 20.04 中安装 g++ sudo apt-get install g++
,但它告诉我:
Some packages cannot be installed.
This can mean that an impossible situation was requested or,
if you are using a development distribution, which some packages
required have not yet been created or have been removed from Incoming.
The following information can help resolve the situation:
The following packages have unmet dependencies:
g++: It depends: g++-9 (> = 9.3.0-3 ~) but it is not going to be installed
E: Unable to fix problems, there are bad packages blocked".
我该如何解决这些问题?
答案1
aptitude 在解决软件包依赖关系方面比 apt-get 更积极。aptitude 会记住哪些软件包是明确请求的,哪些软件包只是由于依赖关系而安装的。当不再需要未明确请求的软件包时,它会自动卸载这些软件包。
使用 安装 aptitude sudo apt install aptitude
,运行sudo apt install g++
并按照 aptitude 提供的建议解决未满足的依赖关系。