我的 qtcreator 无法正常工作,缺少示例、教程等内容。因此,我决定彻底安装所有 qt5 软件包。我使用 ppa-purge 清除了官方 ubuntu-sdk ppa,并尝试重新安装所有内容。
我添加了 developer.ubuntu.com 中提到的 2 个 ppa。我安装了 qtcreator,现在一切正常。但是,当我尝试更新我的 12.04 系统时,我看到错误消息,提示存在未满足的依赖关系。
运行时sudo apt-get dist-upgrade
我收到以下错误输出,
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
libqt4-opengl-dev : Depends: libqt4-dev (= 4:4.8.1-0ubuntu4.4) but it is not installed
libqtwebkit-dev : Depends: libqt4-dev (>= 4:4.8.0~) but it is not installed
E: Unmet dependencies. Try using -f.
因此看来libqt4-dev未安装。我尝试根据 的错误消息进行安装sudo apt-get -f install libqt4-dev
。但随后我收到此错误消息,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
libmysqlclient-dev libpq-dev libsqlite3-dev unixodbc-dev
The following NEW packages will be installed:
libqt4-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
39 not fully installed or removed.
Need to get 0 B/2,516 kB of archives.
After this operation, 18.0 MB of additional disk space will be used.
(Reading database ... 416905 files and directories currently installed.)
Unpacking libqt4-dev (from .../libqt4-dev_4%3a4.8.1-0ubuntu4.4_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/libqt4-dev_4%3a4.8.1-0ubuntu4.4_i386.deb (--unpack):
trying to overwrite '/usr/bin/uic3', which is also in package qtchooser 0.0.1~git20121229.g8f08405-0ubuntu1~precise1~test5
dpkg-deb (subprocess): subprocess data was killed by signal (Broken pipe)
dpkg-deb: error: subprocess <decompress> returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/libqt4-dev_4%3a4.8.1-0ubuntu4.4_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何解决?
[编辑 1]:为了回应 asclepix 的回答,我尝试通过 删除 qtchooser sudo apt-get remove qtchooser
,但我得到的输出是,
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libqt4-opengl-dev : Depends: libqt4-dev (= 4:4.8.1-0ubuntu4.4) but it is not going to be installed
libqtwebkit-dev : Depends: libqt4-dev (>= 4:4.8.0~) but it is not going to be installed
qt5-default : Depends: qtchooser but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
答案1
它似乎与 qtchooser 包冲突:
trying to overwrite '/usr/bin/uic3', which is also in package qtchooser 0.0.1~git20121229.g8f08405-0ubuntu1~precise1~test5
我有 qt4 和 qt4-dev,但没有 qtchooser(可能是因为我使用的是 12.10)。我认为这个包是在 qt3 和 qt4 或 qt5 之间进行选择。如果可能的话(您有 qt3 吗?qt5?),请尝试卸载 qtchooser。
答案2
安装 Ubuntu SDK 后,我的电脑也出现了同样的问题。我在这里找到了解决方案。您必须按照 PPA 的步骤进行操作,我将解决方案放在这里,但我建议您按照教程进行操作。
禁用/删除/清除 PPA:
PPA(个人软件包存档)是托管在 Launchpad 上的存储库。您可以使用 PPA 安装或升级官方 Ubuntu 存储库中没有的软件包。
未满足依赖关系的最常见原因之一是 PPA,尤其是在用于升级 Ubuntu 存储库中的现有软件包时。要解决此问题,您可以使用三项选项、禁用、清除(恢复为 Ubuntu 存储库中的原始软件包)或删除 PPA。
Disable:
Disabling a PPA means no more updates for the packages installed from that PPA. To disable a PPA: Open Software Center > Edit > Software Sources Or,
Hit Alt+F2 and run software-properties-gtk.
Click on Other Software tab, you'll see that each PPA have two lines here, one for the compiled packages and one for the source, Uncheck both lines to disable a PPA. Hare you can also add and remove PPAs.
Purge:
Purging a PPA means, downgrading the packages in the selected PPA to the version in the official Ubuntu repositories and disabling that PPA. PPA Purge does exactly that. To install PPA Purge run the following command:
sudo apt-get install ppa-purge
但是,考虑到问题 apt 已损坏,因此上述命令将失败。因此使用此命令
mkdir ppa-purge && cd ppa-purge && wgethttp://mirror.pnl.gov/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb&& wgethttp://mirror.pnl.gov/ubuntu//pool/main/a/aptitude/aptitude_0.6.6-1ubuntu1_i386.deb&& sudo dpkg -i ./*.deb
要使用 PPA Purge:
sudo ppa-purge ppa:someppa/ppa
如果“ppa-purge”命令由于某种原因失败,则您无法再次运行“ppa-purge”,除非您重新启用 PPA(要启用 PPA,请按照与禁用 PPA 相同的步骤进行操作,并检查特定 PPA 的两行以启用它)。
注意:PPA Purge 不会删除 PPA(将来可能会删除),因此您必须手动删除 PPA。
它对我有用。