如何在 Ubuntu 20.02 中安装 libqt4-dev

如何在 Ubuntu 20.02 中安装 libqt4-dev

我尝试libqt4-dev在 Ubuntu 20.04 上安装,但出现以下错误:

kjs@PC:~/Downloads$ sudo apt-get install -y libqt4-dev
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libqt4-dev : Depends: libqt4-dbus (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-declarative (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-designer (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-dev-bin (= 5:4.8.7+dfsg-7ubuntu4rock7)
              Depends: libqt4-help (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-network (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-qt3support (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-script (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-scripttools (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-sql (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-svg (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-test (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-xml (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-xmlpatterns (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqtcore4 (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqtgui4 (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: qt4-linguist-tools (= 5:4.8.7+dfsg-7ubuntu4rock7)
              Depends: qt4-qmake (= 5:4.8.7+dfsg-7ubuntu4rock7)
              Depends: qtchooser (>= 55-gc9562a1-1~)
              Recommends: libqt4-opengl-dev (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
 libqtgui4:i386 : Depends: libpng12-0:i386 (>= 1.2.13-4) but it is not going to be installed
                  Recommends: qt-at-spi:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

之后我尝试过:

sudo add-apt-repository ppa:rock-core/qt4 
sudo apt-get update
sudo apt-get install libqtcore4

并得到以下错误:

~$ sudo apt-get install libqtcore4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libqtcore4 : Breaks: libqtcore4:i386 (!= 5:4.8.7+dfsg-7ubuntu4rock7) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
 libqtcore4:i386 : Breaks: libqtcore4 (!= 4:4.8.7+dfsg-5ubuntu2) but 5:4.8.7+dfsg-7ubuntu4rock7 is to be installed
 libqtgui4:i386 : Depends: libpng12-0:i386 (>= 1.2.13-4) but it is not going to be installed
                  Recommends: qt-at-spi:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我还尝试使用以下命令安装 Qt5:

sudo apt-get install git g++ python libeigen3-dev zlib1g-dev libqt5opengl5-dev libqt5svg5-dev libgl1-mesa-dev libfftw3-dev libtiff5-dev libpng-dev

并得到以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version (4:9.3.0-1ubuntu2).
g++ set to manually installed.
libpng-dev is already the newest version (1.6.37-2).
git is already the newest version (1:2.25.1-1ubuntu3.10).
libgl1-mesa-dev is already the newest version (21.2.6-0ubuntu0.1~20.04.2).
libgl1-mesa-dev set to manually installed.
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu1.5).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libfftw3-dev : Depends: libfftw3-bin (= 3.3.8-2ubuntu1)
                Depends: libfftw3-double3 (= 3.3.8-2ubuntu1) but it is not going to be installed
                Depends: libfftw3-long3 (= 3.3.8-2ubuntu1) but it is not going to be installed
                Depends: libfftw3-quad3 (= 3.3.8-2ubuntu1) but it is not going to be installed
 libqt5opengl5-dev : Depends: libqt5opengl5 (= 5.12.8+dfsg-0ubuntu2.1) but it is not going to be installed
                     Depends: qtbase5-dev (= 5.12.8+dfsg-0ubuntu2.1)
 libqt5svg5-dev : Depends: libqt5svg5 (= 5.12.8-0ubuntu1) but it is not going to be installed
 libqtgui4:i386 : Depends: libpng12-0:i386 (>= 1.2.13-4) but it is not going to be installed
                  Recommends: qt-at-spi:i386 but it is not going to be installed
 python : PreDepends: python-minimal (= 2.7.11-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.11-1~) but it is not going to be installed
          Depends: libpython-stdlib (= 2.7.11-1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

Ubuntu 20.04 删除了其官方存储库中的qt4所有依赖项。libqt4-*将此 PPA 存储库添加到您的系统中可能会解决您的问题。

sudo add-apt-repository ppa:rock-core/qt4
sudo apt-get update

然后,安装qt4.

sudo apt-get install libqtcore4

相关内容