如何在 Windows 上安装 PyQt5? [英] How to install PyQt5 on Windows?

查看:105
本文介绍了如何在 Windows 上安装 PyQt5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用命令在 Windows 上安装 PyQt5 时

python configure.py

我收到此错误:

<块引用>

错误:确保您的 PATH 上有一个有效的 Qt qmake.

我从 PyQt5 下载获得了 pyQt5.

如何安装 PyQt5?

<小时>

更新:

我从Qt 下载页面 现在我有这个错误:

<块引用>

正在查询 qmake 关于您的 Qt 安装...正在确定 Qt 安装的详细信息...错误:无法确定 Qt 安装的详细信息.再次尝试使用--verbose 标志以查看有关问题的更多详细信息.

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

<块引用>

正在查询 qmake 关于您的 Qt 安装...正在确定 Qt 安装的详细信息...C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qmake.exe -spec win32-msvc2008 -o qtdetail.mk qtdetail.pronmake -f qtdetail.mk 发布'nmake' não é reconhecido como um comando internoou externo, um programa operável ou um arquivo em lotes.错误:无法确定 Qt 安装的详细信息.再次尝试使用--verbose 标志以查看有关问题的更多详细信息.

我将 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin(包含 nmake.exe)添加到 PATH 中,但出现此错误:

<块引用>

正在查询 qmake 关于您的 Qt 安装...正在确定 Qt 安装的详细信息...C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qmake.exe -spec win32-msvc2008 -o qtdetail.mk qtdetail.pronmake -f qtdetail.mk 发布Microsoft (R) 程序维护实用程序版本 11.00.50727.1版权所有 (C) 微软公司.版权所有."C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe" -f qtdetail.mk.ReleaseMicrosoft (R) 程序维护实用程序版本 11.00.50727.1版权所有 (C) 微软公司.版权所有.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.tmpNMAKE:致命错误 U1077:'"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.EXE"':返回代码 '0xc0000135'停止.NMAKE:致命错误 U1077:'"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe"':返回代码 '0x2'停止.

解决方案

安装 PyQt 的最简单方法是使用安装程序(链接在您的答案中,第 5 步).如果您安装 python 3.3,安装程序会自动将所有 PyQt5 附加组件添加到该 python 安装中.你不需要做任何编译(没有:nmake、nmake install、python configure).

如果您需要自定义安装,则所有构建选项都可用(例如,使用不同版本的 Python,其中没有 Riverbank 计算提供的安装程序).

如果您确实需要编译自己的 PyQt5 版本,步骤(如您所见)是这里,但假设您安装了 python 和编译器,并且在您的路径中.安装的和在您的路径中似乎是您遇到麻烦的地方.我建议使用安装程序版本,但您需要先安装 python 3.3.

When I try installing the PyQt5 on Windows using the command

python configure.py

I get this error:

Error: Make sure you have a working Qt qmake on your PATH.

I got the pyQt5 from PyQt5 Download.

How can I install PyQt5?


Update:

I installed Qt 5.0.2 for Windows 64-bit (VS 2012, 500 MB) from the Qt Download page and now I have this error:

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.

And when I execute the command 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.

I added C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin (contains nmake.exe) to PATH and I got this error:

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.

解决方案

The easiest way to install PyQt is to just use the installer (Link in your answer, step #5). If you install python 3.3, the installer will add all of the PyQt5 extras to that python installation automatically. You won't need to do any compiling (none of: nmake, nmake install, python configure).

All of the build options are available for if you need a custom install (for instance, using a different version of python, where there isn't an installer provided by riverbank computing).

If you do need to compile your own version of PyQt5, the steps (as you have found) are here, but assume you have python and a compiler installed and in your path. The installed and in your path have been where you have been running into trouble it seems. I'd recommend using the installer version, but you need to install python 3.3 first.

这篇关于如何在 Windows 上安装 PyQt5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆