【问题标题】:Where is pyside-uic?pyside-uic 在哪里?
【发布时间】:2011-07-13 19:03:56
【问题描述】:

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

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

还有一堆其他程序,但是没有pyside-uic.exe之类的东西……为什么?为什么安装包中缺少它?我在哪里得到它?

【问题讨论】:

  • 是的,我读过它,但这对我来说意义不大。希望它对你有意义,如果没有,对不起。

标签: python qt pyside


【解决方案1】:

如果您使用 homebrew 安装 PySide,您还需要安装 pyside-tools 包以获取这些命令行工具:

$ brew install pyside-tools

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 感谢您找到它,我已经搜索过,但搜索无法找到它。现在的问题是:i.imgur.com/VOtRO.png
    • 错误的架构会导致这种情况吗?含义:在 32 位系统上的 64 位可执行文件,反之亦然。
    • 您在该屏幕截图上输入的是“python-uic”,而不是“pyside-uic”。
    【解决方案3】:

    当我使用 conda 安装时,py-uic.exe 没有解压。问题已通过卸载和使用 pip 得到解决。

    >pip install pyside
    

    【讨论】:

      【解决方案4】:

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

      sudo port install py27-pyside-tools
      

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

      【讨论】:

        【解决方案5】:

        几年过去了,有些事情已经解决了:我想现在的官方答案是:

        使用 uic.exe!但是怎么做呢?

        因此,尽管the official docs 仍然缺少任何有关它的信息,但您现在可以使用您通过pip install PySide2 获得的 PySide2 包随附的可执行文件直接将.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.
        

        【讨论】:

          【解决方案6】:

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

          sudo apt-get install pyside-tools
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-05-25
            • 1970-01-01
            • 1970-01-01
            • 2014-07-06
            • 2015-03-19
            • 1970-01-01
            相关资源
            最近更新 更多