pyside-uic 在哪里?

发布于 2024-11-19 19:01:52 字数 219 浏览 3 评论 0原文

我正在尝试使用 Qt Designer 和 pyside-uic mydesign.ui > design.py

但是,这个程序不存在。我查看了 python 2.7 下的站点包,我看到: pyside-lupdate.exe pyside-rcc.exe

和一堆其他程序,但没有 pyside-uic.exe 这样的东西......为什么?为什么安装包里没有这个?我在哪里可以得到它?

I'm trying to use Qt Designer and pyside-uic mydesign.ui > design.py

however, this program doesn't exist. I looked in site packages under python 2.7, and I see:
pyside-lupdate.exe
pyside-rcc.exe

and a bunch of other programs, but there is no such thing as pyside-uic.exe ... why ?? Why is it missing from the installation package? Where do I get it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

糖粟与秋泊 2024-11-26 19:01:53

几年过去了,有些问题得到了解决:我想现在的官方答案是:

使用 uic.exe!但如何呢?

因此,尽管官方文档仍然缺乏有关它的任何信息,但你现在可以编译<使用通过 pip install PySide2 获得的 PySide2 包附带的可执行文件,直接将 code>.ui 文件传输到 Python。您可以这样编写它:

uic.exe -g python your_design.ui -o your_design_ui.py

其中 your_design.ui 是 Qt Designer 文件,your_design_ui.py 是要生成的目标 Python 文件。瞧!

顺便说一句:这是来自 uic -? 的帮助

C:\Python38\Lib\site-packages\PySide2>uic.exe -h
Usage: uic.exe [options] [uifile]
Qt User Interface Compiler version 5.15.0

Options:
-?, -h, --help                Displays help on commandline options.
--help-all                    Displays help including Qt specific options.
-v, --version                 Displays version information.
-d, --dependencies            Display the dependencies.
-o, --output <file>           Place the output into <file>
-a, --no-autoconnection       Do not generate a call to
                                QObject::connectSlotsByName().
-p, --no-protection           Disable header protection.
-n, --no-implicit-includes    Disable generation of #include-directives.
-s, --no-stringliteral        Deprecated. The use of this option won't take
                                any effect.
--postfix <postfix>           Postfix to add to all generated classnames.
--tr, --translate <function>  Use <function> for i18n.
--include <include-file>      Add #include <include-file> to <file>.
-g, --generator <python|cpp>  Select generator.
--idbased                     Use id based function for i18n
--from-imports                Python: generate imports relative to '.'

Arguments:
[uifile]                      Input file (*.ui), otherwise stdin.

Since a couple years passed by and some things were fixed: I guess the official answer would now be:

Use uic.exe! But how?

So although the official docs still lack any info about it you can now compile .ui files to Python directly with this executable shipped with the PySide2 package you get via pip install PySide2. This is how you would write it:

uic.exe -g python your_design.ui -o your_design_ui.py

Where your_design.ui is the Qt Designer file and your_design_ui.py the target Python file to generate. Voilà!

Btw: here is the help from uic -?

C:\Python38\Lib\site-packages\PySide2>uic.exe -h
Usage: uic.exe [options] [uifile]
Qt User Interface Compiler version 5.15.0

Options:
-?, -h, --help                Displays help on commandline options.
--help-all                    Displays help including Qt specific options.
-v, --version                 Displays version information.
-d, --dependencies            Display the dependencies.
-o, --output <file>           Place the output into <file>
-a, --no-autoconnection       Do not generate a call to
                                QObject::connectSlotsByName().
-p, --no-protection           Disable header protection.
-n, --no-implicit-includes    Disable generation of #include-directives.
-s, --no-stringliteral        Deprecated. The use of this option won't take
                                any effect.
--postfix <postfix>           Postfix to add to all generated classnames.
--tr, --translate <function>  Use <function> for i18n.
--include <include-file>      Add #include <include-file> to <file>.
-g, --generator <python|cpp>  Select generator.
--idbased                     Use id based function for i18n
--from-imports                Python: generate imports relative to '.'

Arguments:
[uifile]                      Input file (*.ui), otherwise stdin.
白日梦 2024-11-26 19:01:53

如果有人需要它,对于 Ubuntu 18.04,我需要先安装 pyside-tools 包。希望有帮助。

sudo apt-get install pyside-tools

In case someone need it, for Ubuntu 18.04 I need to install pyside-tools package first. Hope that helps.

sudo apt-get install pyside-tools
梦归所梦 2024-11-26 19:01:52

如果您使用自制程序安装了 PySide,则还需要安装 pyside-tools 包才能获取这些命令行工具:

$ brew install pyside-tools

If you installed PySide with homebrew, you need to install pyside-tools package also to get these command line tools:

$ brew install pyside-tools
她说她爱他 2024-11-26 19:01:52

您应该看到 /Python27/Scripts/pyside-uic.exe。但我想知道为什么它不可见(不可执行)。也许这是一个包装问题(权限等)。您可以尝试使用完整路径来调用它。

You should see a /Python27/Scripts/pyside-uic.exe. But I'm wondering why it's not visible (not executable). Maybe it's a packaging problem (permissions, etc). You could try to call it using the complete path.

烦人精 2024-11-26 19:01:52

当我使用 conda 安装时,py-uic.exe 未解压。通过卸载并使用 pip 解决了该问题。

>pip install pyside

When I installed using conda, the py-uic.exe was not unpacked. The problem was fixed by uninstalling and using pip.

>pip install pyside
如梦 2024-11-26 19:01:52

对于 Mac,它适用于我运行以下命令(需要安装 macports):

sudo port install py27-pyside-tools

它安装在我的 Python 2.7 环境中。
我希望它有帮助。

For Mac it worked for me running the following command (needed to have macports installed):

sudo port install py27-pyside-tools

It installs on my Python 2.7 environment.
I hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文