問題描述
現在感覺真的很愚蠢,但標題說明了一切:
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%AppDataLocalProgramsPythonPython36Libsite-packagesPyQt5
現在呢?有很多 .pyd 文件,也有一些 .dll,但沒有可執行文件(嗯,除了 ...site-packagesPyQt5Qtin 中的
QtWebEngineProcess.exe
,但這聽起來不像我要找的.??p>
Now what? There are a lot of .pyd files, some .dll's, too, but nothing executable (well, except a QtWebEngineProcess.exe
in ...site-packagesPyQt5Qtin
, 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 設計器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!