PyQt5:如何安装/运行 Qt Designer [英] PyQt5: How to install/run Qt Designer

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

问题描述

现在感觉很愚蠢,但标题说明了一切:

Feeling really stupid, right now, but the title says it all:

如何启动 QtDesigner?

How do you start the QtDesigner?

我已经通过 pip 安装了 PyQt5 并且我相信已经确定它的安装目录为

I've installed PyQt5 via pip and I believe to have identified the directory it's been installed in as

C:\Users\%username%\AppData\Local\Programs\Python\Python36\Lib\site-packages\PyQt5

现在呢?有很多 .pyd 文件,也有一些 .dll 文件,但没有任何可执行文件(好吧,除了 ...\site-packages\PyQt5\Qt\bin 中的 QtWebEngineProcess.exe,但这听起来不像我要找的.

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.

推荐答案

最新的 PyQt5 轮子(可以通过 pip 安装)只包含运行应用程序所需的内容,不包括开发工具.这适用于 PyQt 5.7 及更高版本.对于 PyQt 5.6 及更早版本,Windows 的二进制包也包含开发工具,这些仍然可以在 sourceforge.不过,PyQt 的维护者不打算发布此类二进制包的任何进一步版本 - 现在只会提供运行时轮子,并且不会为开发工具提供官方轮子.

The latest PyQt5 wheels (which can be installed via pip) only contain what's necessary for running applications, 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-tools wheel(用于仅限 Windows).不过,这似乎还处于早期阶段,因此可能跟不上最近的 PyQt5 版本.这意味着可能并不总是可以通过 pip 安装它.如果是这种情况,作为一种变通方法,可以将车轮文件视为 zip 文件并将内容提取到合适的位置.这应该允许您运行 pyqt5-tools/designer 文件夹中的 designer.exe 文件.

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.

最后,请注意,您还将在 sourceforge 中看到一些用于 PyQt5 的 zip 和 tar.gz 文件.但是,这些仅包含源代码,因此除非您打算自己编译 PyQt5,否则对您没有用.需要明确的是:从源代码编译仍然不会为您提供所有 Qt 开发工具.如果你沿着这条路走下去,你还需要单独安装整个 Qt 开发工具包(这会然后为你提供开发工具).

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 would then get you the dev tools).

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

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