Python PyQt5:如何安装/运行 Qt Designer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42090739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PyQt5: How to install/run Qt Designer
提问by User1291
Feeling really stupid, right now, but the title says it all:
现在感觉真的很愚蠢,但标题说明了一切:
Howdo you start the QtDesigner?
你如何启动 QtDesigner?
I've installed PyQt5
via pip
and I believe to have identified the directory it's been installed in as
我已经PyQt5
通过安装pip
,我相信已经确定了它安装的目录为
C:\Users\%username%\AppData\Local\Programs\Python\Python36\Lib\site-packages\PyQt5
Now what? There are a lot of .pyd files, some .dll's, too, but nothing executable (well, except a QtWebEngineProcess.exe
in ...\site-packages\PyQt5\Qt\bin
, but that doesn't sound like what I'm looking for.
怎么办?有很多 .pyd 文件,也有一些 .dll 文件,但没有任何可执行文件(嗯,除了QtWebEngineProcess.exe
in ...\site-packages\PyQt5\Qt\bin
,但这听起来不像我要找的。
采纳答案by ekhumoro
The latest PyQt5 wheels (which can be installed via pip) only contain what's necessary for runningapplications, and don't include the dev tools. This applies to PyQt versions 5.7 and later. For PyQt versions 5.6 and earlier, there are binary packages for Windows that also include the dev tools, and these are still available at sourceforge. The maintainer of PyQt does not plan on making any further releases of such binary packages, though - only the runtime wheels will now be made available, and there will be no official wheels for the dev tools.
最新的 PyQt5 轮子(可以通过 pip 安装)仅包含运行应用程序所需的内容,不包含开发工具。这适用于 PyQt 5.7 及更高版本。对于 PyQt 5.6 及更早版本,有适用于 Windows 的二进制包,其中还包含开发工具,这些在sourceforge中仍然可用。不过,PyQt 的维护者不打算发布此类二进制包的任何进一步版本——现在只会提供运行时轮子,并且不会有用于开发工具的官方轮子。
In light of this, someone has created an unofficial pyqt5-tools wheel(for Windows only). This appears to be in it's early stages, though, and so may not keep up with recent PyQt5 releases. This means that it may not always be possible to install it via pip. If that is the case, as a work-around, the wheel files can be treated as zip files and the contents extracted to a suitable location. This should then allow you to run the designer.exe
file that is in the pyqt5-tools/designer
folder.
鉴于此,有人创建了一个非官方的pyqt5-tools 轮(仅适用于 Windows)。不过,这似乎还处于早期阶段,因此可能跟不上最近的 PyQt5 版本。这意味着可能并不总是可以通过 pip 安装它。如果是这种情况,作为一种变通方法,可以将车轮文件视为 zip 文件并将内容提取到合适的位置。这应该允许您运行designer.exe
文件pyqt5-tools/designer
夹中的文件。
Finally, note that you will also see some zip and tar.gz files at sourceforge for PyQt5. These only contain the source code, though, so will be no use to you unless you intend to compile PyQt5 yourself. And just to be clear: compiling from source still would not give you all the Qt dev tools. If you go down that route, you would need to install the whole Qt development kit separately as well (which wouldthen get you the dev tools).
最后,请注意,您还将在 sourceforge 中看到一些用于 PyQt5 的 zip 和 tar.gz 文件。但是,这些只包含源代码,因此除非您打算自己编译 PyQt5,否则对您没有用。需要明确的是:从源代码编译仍然不会为您提供所有 Qt 开发工具。如果您沿着这条路线走下去,您还需要单独安装整个 Qt 开发工具包(这将为您提供开发工具)。
回答by Uriel
The Qt designer is notinstalled with the pip
installation.
Qt 设计器未随安装一起pip
安装。
You can either download the full download from sourceforge(probably won't be the last pyqt release, and might be buggy on presence of another installation, like yours) orinstall it with another (unofficial) pypi
package - pyqt5-tools(pip install pyqt5-tools
), then run the designer from the following subpath of your python directory -
您可以从sourceforge下载完整的下载(可能不会是最后一个 pyqt 版本,并且可能会在存在另一个安装时出现问题,例如您的)或使用另一个(非官方)pypi
包安装它- pyqt5-tools( pip install pyqt5-tools
),然后从 python 目录的以下子路径运行设计器 -
...\Python36\Lib\site-packages\pyqt5-tools\designer\designer.exe
回答by Michael Herrmann
I struggled with this as well. The pyqt5-tools
approach is cumbersome so I created a standalone installer for Qt Designer. It's only 40 MB. Maybe you will find it useful!
我也为此苦苦挣扎。这种pyqt5-tools
方法很麻烦,所以我为 Qt Designer创建了一个独立的安装程序。它只有 40 MB。也许你会发现它很有用!
回答by Sairaj Das
pip install pyqt5-tools
Then restart the cmd, just type "designer" and press enter.
然后重新启动cmd,输入“designer”并回车即可。
回答by dima_showstopper
pip install pyqt5-tools
pip 安装 pyqt5-tools
workingin python 3.7.4
在 python 3.7.4 中工作
wont workin python 3.8.0
无法在 python 3.8.0 中工作
回答by akej74
You can also install Qt Designer the following way:
您还可以通过以下方式安装 Qt Designer:
- Install latest Qt (I'm using 5.8) from Qt main site
- Make sure you include "Qt 5.8 MinGW" component
- Qt Designer will be installed in
C:\Qt\5.8\mingw53_32\bin\designer.exe
- Note that the executable is named "designer.exe"
- 从Qt 主站点安装最新的 Qt(我使用的是 5.8)
- 确保包含“Qt 5.8 MinGW”组件
- Qt Designer 将安装在
C:\Qt\5.8\mingw53_32\bin\designer.exe
- 请注意,可执行文件名为“designer.exe”
回答by M Pavan Kumar
Try using:
尝试使用:
pip install pyqt5-tools
Now you'd find the designer in site-packages/pyqt5-tools
.
现在你会在site-packages/pyqt5-tools
.
回答by Gray Hat
Easily download this module
pip install PyQt5Designerthen open
C:\ProgramData\AnacondaX\Lib\site-packages\QtDesigner\designer.exe
for anaconda users
轻松下载此模块
pip install PyQt5Designer然后
为 anaconda 用户打开
C:\ProgramData\AnacondaX\Lib\site-packages\QtDesigner\designer.exe
C:\Program Files\PythonXX\Lib\site-packages\QtDesigner\designer.exeC:\Program Files (x86)\PythonXX\Lib\site-packages\QtDesigner\designer.exefor python users
C:\Program Files\PythonXX\Lib\site-packages\QtDesigner\designer.exe C:\Program Files (x86)\PythonXX\Lib\site-packages\QtDesigner\designer.exefor python 用户
回答by Guilherme Denobi
I was having the same problem, however I was able to install using the Pygame module installation code, changing some information: -pygame (py -m pip install -U pygame --user) -PyQt5 (py -m pip install -U pyqt5-tools --user)
我遇到了同样的问题,但是我能够使用 Pygame 模块安装代码进行安装,更改了一些信息:-pygame (py -m pip install -U pygame --user) -PyQt5 (py -m pip install -U pyqt5 -工具--用户)