在 ubuntu 16.04 上安装 Qt 遇到问题

在 ubuntu 16.04 上安装 Qt 遇到问题

我正在关注关联在我的 PC 上安装 Qt。

当我输入时sudo apt-get install build-essential g++ libqt4-core libqt4-dev libqt4-gui qt4-doc qt4-designer,出现此错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
g++ is already the newest version (4:5.3.1-1ubuntu1).
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:
libqt4-core : Depends: libqt4-dbus (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
           Depends: libqt4-network (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
           Depends: libqt4-script (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
           Depends: libqt4-test (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
           Depends: libqt4-xml (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
           Depends: libqtcore4 (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
libqt4-gui : Depends: libqt4-designer (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
          Depends: libqt4-opengl (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
          Depends: libqt4-svg (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
          Depends: libqtgui4 (= 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

我关注了关联寻求帮助,但在输入此命令后sudo apt install libqt4-designer libqt4-opengl libqt4-svg libqtgui4 libqtwebkit4,我应该创建一个脚本文件,但我无法正确理解如何执行此操作。

该命令成功运行sudo apt-get install libqglviewer-dev libqglviewer2但是sudo apt-get install libboost1.48-all-dev没有运行,我收到此错误:

Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libboost1.48-all-dev E: Couldn't find any package by glob 'libboost1.48-all-dev' E: Couldn't find any package by regex 'libboost1.48-all-dev'

的输出apt-cache policy libqtcore4为: libqtcore4: Installed: 4:4.8.7+dfsg-5ubuntu2 Candidate: 4:4.8.7+dfsg-5ubuntu2 Version table: *** 4:4.8.7+dfsg-5ubuntu2 500 500 http://pk.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 500 500 http://ftp.ca.debian.org/debian jessie/main amd64 Packages

怎么才能解决这一切呢?

答案1

由于你运行的是普通的 Ubuntu 16.04 LTS(赛尼尔),那么你应该删除所有 Debian杰西/etc/apt/sources.list来自您的和文件的提及/etc/apt/sources.list.d/

您可以使用以下方法找到此类文件:

grep -r jessie /etc/apt/sources.list /etc/apt/sources.list.d/*.list

然后通过在开始处添加以下内容注释掉有问题的行#并重试:

sudo apt-get update
sudo apt-get install build-essential g++ libqt4-core libqt4-dev libqt4-gui qt4-doc qt4-designer

相关内容