简体   繁体   English

无法在 python 2.7 上安装 pyqt5

[英]Can't install pyqt5 on python 2.7

I want to install pyqt5 on python 2.7.我想在 python 2.7 上安装 pyqt5。 I've tried to download on their website, but I can't open the website.我试图在他们的网站上下载,但我无法打开该网站。 I used:我用了:

pip install

and I got:我得到了:

ERROR: Could not find a version that satisfies the requirement pyqt5 (from versions: none)
ERROR: No matching distribution found for pyqt5

You didn't mention an OS, but here is my experience with OSX - hopefully it is helpful to someone.您没有提到操作系统,但这是我使用 OSX 的经验 - 希望对某人有所帮助。

pyqt5 installed though pip appears to require python3 - and I couldn't find a way around it.尽管 pip 似乎需要 python3,但安装了 pyqt5 - 我找不到解决方法。 After spending a bit of time trying to figure this out recently, there are two options I know of:最近花了一些时间试图弄清楚这一点后,我知道有两种选择:

1) build from source, eg https://robonobodojo.wordpress.com/2017/02/08/installing-pyqt4-on-mac-osx/ , https://fredrikaverpil.github.io/2015/11/25/compiling-pyqt5-for-python-2-7-on-os-x/ , for pyqt4 (just in case), pyqt5, respectively. 1)从源代码编译,例如https://robonobodojo.wordpress.com/2017/02/08/installing-pyqt4-on-mac-osx/https://fredrikaverpil.github.io/2015/11/25/编译-pyqt5-for-python-2-7-on-os-x/ ,分别用于pyqt4(以防万一),pyqt5。

2) install using conda https://docs.conda.io/en/latest/miniconda.html 2) 使用 conda https://docs.conda.io/en/latest/miniconda.html安装

I was unable to get 1) working for me (on OSX 10.14.5) due to, I believe, an issue with paths configuration.我无法获得 1) 为我工作(在 OSX 10.14.5 上),因为我相信路径配置存在问题。 But conda worked immediately.但是 conda 立即起作用了。 Once installed (by choosing the python2 install), just do conda install pyqt .安装后(通过选择 python2 安装),只需执行conda install pyqt

edit: there is also an Ubuntu guide for building from source here : https://plashless.wordpress.com/2014/03/26/building-pyqt5-for-python2-7-on-a-clean-ubuntu-13-10-build-machine/编辑:这里还有一个从源代码构建的 Ubuntu 指南: https : //plashless.wordpress.com/2014/03/26/building-pyqt5-for-python2-7-on-a-clean-ubuntu-13- 10-build-machine/

pyqt5 需要 python 3.4 或更高版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM