在 Ubuntu 14.04 上为 Python 2.7 安装 PyQt5 的最佳方法

在 Ubuntu 14.04 上为 Python 2.7 安装 PyQt5 的最佳方法

我正在尝试在我的 Ubuntu 机器上安装 PyQt5。我已经能够安装 Python 3 的软件包,但是,我的代码依赖于 pygraphviz,而 pygraphviz 对 Python 2.7 有很强的依赖性。

我浏览了 repos 并发现有一个适用于它的包:

python-pyqt5(5.3.2+dfsg-1ubuntu1)

因此我尝试以下操作:

sudo apt-get install python-pyqt5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python-pyqt5

因此我下载了该软件包并尝试手动安装:

sudo dpkg -i python-pyqt5_5.3.2+dfsg-1ubuntu1_amd64.deb 
Selecting previously unselected package python-pyqt5.
(Reading database ... 253766 files and directories currently installed.)
Preparing to unpack python-pyqt5_5.3.2+dfsg-1ubuntu1_amd64.deb ...
Unpacking python-pyqt5 (5.3.2+dfsg-1ubuntu1) ...
dpkg: dependency problems prevent configuration of python-pyqt5:
 python-pyqt5 depends on libqt5core5a (>= 5.3.0); however:
  Version of libqt5core5a:amd64 on system is 5.2.1+dfsg-1ubuntu14.3.
 python-pyqt5 depends on libqt5gui5 (>= 5.3.0) | libqt5gui5-gles (>= 5.3.0); however:
  Version of libqt5gui5:amd64 on system is 5.2.1+dfsg-1ubuntu14.3.
  Package libqt5gui5-gles is not installed.
 python-pyqt5 depends on libqt5help5 (>= 5.3.0); however:
  Version of libqt5help5:amd64 on system is 5.2.1-8build1.
 python-pyqt5 depends on libqt5network5 (>= 5.3.0); however:
  Version of libqt5network5:amd64 on system is 5.2.1+dfsg-1ubuntu14.3.
 python-pyqt5 depends on libqt5printsupport5 (>= 5.3.0); however:
  Version of libqt5printsupport5:amd64 on system is 5.2.1+dfsg-1ubuntu14.3.
 python-pyqt5 depends on libqt5widgets5 (>= 5.3.0); however:
  Version of libqt5widgets5:amd64 on system is 5.2.1+dfsg-1ubuntu14.3.
 python-pyqt5 depends on qtbase-abi-5-3-0; however:
  Package qtbase-abi-5-3-0 is not installed.
 python-pyqt5 depen
dpkg: error processing package python-pyqt5 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-pyqt5

我发现我可能有一些过时的软件包,我尝试使用 apt-get update 进行更新,但没有结果。

我已经下载了源代码进行构建;但是,我更愿意使用包管理来控制依赖项。有没有关于如何使用 apt 解决这个问题的建议?

谢谢你的帮助!约瑟夫

答案1

我在这里找到了这个问题的答案:https://riverbankcomputing.com/pipermail/pyqt/20​​14-May/034175.html

基本上,似乎 PyQt5 的 Python 2 版本没有包含在 Ubuntu 14.04 存储库中;不过,它们似乎包含在 14.10 中。

因此,我从源代码安装了 PyQt5,但这也存在一些问题: https://stackoverflow.com/questions/32080304/issues-with-building-pyqt5-on-ubuntu-14-04

无论如何,我现在已经在我的盒子上安装了 PyQt5。

答案2

我强烈建议你安装蟒蛇并使用 conda 安装

conda install pyqt

相关内容