如何在Windows上安装PyQt5?

32
当我尝试在Windows上使用命令安装PyQt5时,需要执行以下步骤:
python configure.py

我得到了这个错误:
Error: Make sure you have a working Qt qmake on your PATH.
我从PyQt5下载获取了pyQt5。
我该如何安装PyQt5?

更新:

我从Qt下载页面下载并安装了Qt 5.0.2 for Windows 64-bit (VS 2012, 500 MB),现在出现了这个错误:

Querying qmake about your Qt installation...
Determining the details of your Qt installation...
Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

当我执行命令python configure.py --verbose时:

Querying qmake about your Qt installation...
Determining the details of your Qt installation...
C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qmake.exe -spec win32-msvc2008 -o qtdetail.m
k qtdetail.pro
nmake -f qtdetail.mk release
'nmake' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.
我将"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin"(包含“nmake.exe”)添加到PATH中,但我遇到了以下错误:
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qmake.exe -spec win32-msvc2008 -o qtdetail.mk qtdetail.pro
nmake -f qtdetail.mk release


Microsoft (R) Program Maintenance Utility Version 11.00.50727.1

Copyright (C) Microsoft Corporation.  All rights reserved.


  "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe" -f qtdetail.mk.Release


Microsoft (R) Program Maintenance Utility Version 11.00.50727.1

Copyright (C) Microsoft Corporation.  All rights reserved.

  cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_CORE_LIB -I"..\..\..\..\..\..\..\Qt\Qt5.0.2\5.0.2\msvc2012_64\include" -I"..\..\..\..\..\..\..\Qt\Qt5.0.2\5.0.2\msvc2012_64\include\QtCore" -I"release" -I"..\..\..\..\..\..\..\Qt\Qt5.0.2\5.0.2\msvc2012_64\mkspecs\win32-msvc2008" -Forelease\ @C:\Users\Victor\AppData\Local\Temp\nm68EA.tmp

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.EXE"' : return code '0xc0000135'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe"' : return code '0x2'

Stop.

1
你安装了QT吗?pyQT应该需要QT。 - brentlance
1
我安装了QT,现在出现另一个错误:'nmake'不是内部命令. 如何解决? - Victor Lellis
1
我认为虽然您已将nmake.exe添加到了PATH中,但还需要设置其他环境变量(例如包含和库路径)。对我而言有效的方法是从Visual Studio命令提示符中运行所有命令。这将自动设置所有必要的环境变量。VS Cmd提示符应该与VS一起安装,并且应该在您的开始菜单中。我成功编译并安装了PyQT5,但当我运行任何示例时,都会出现错误,例如: from PyQt5.QtCore import QEventLoop, QTime SystemError: error return without exception set - actf
@actf pip3安装pyqt5 - tyasird
22个回答

0

安装GPL版本的PyQt5,请运行(参见PyQt5项目):

pip3 install pyqt5

这将安装适用于您的平台和Python版本的Python wheel(假设两者都受支持)。

(该wheel将从Python Package Index自动下载。)

PyQt5 wheel 包括LGPL版Qt的必要部分无需自行安装Qt

(所需的sip已打包为单独的wheel,并将自动下载和安装。)


注意:

如果你收到一个错误信息,内容如下:

No downloads could be found that satisfy the requirement 

那么你可能正在使用一个不受支持的 Python 版本。


支持哪些版本? - john k
@john,Python 3.5+ - MarianD

-1

你好,你可以从这里获取答案: https://www.lfd.uci.edu/~gohlke/pythonlibs/

要找到你的模块,请按ctrl + f,然后输入pyqt5, 然后点击与你的系统相关的任何一个文件 PyQt5 然后在下载模块后将其提取到python >> lib >> site-packages。然后在那里提取它。 我已经完成了我的回答,希望有所帮助。


您提供的 PYQT5 安装方法并不通用,也不是适合的方法。 - Adib

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接