'Pyuic4' is not recognized as an internal external command

前端 未结 4 1433
面向向阳花
面向向阳花 2021-01-18 04:31

Im trying to compile a ui file by using Pyuic, but i can\'t get it to work... Every time i try using the command

pyuic4 -o OutFile_ui.py InFile.ui

相关标签:
4条回答
  • 2021-01-18 05:20

    When you install PyQt, it gets install under Python's site-packages.

    There is a batch file pyuic.bat under the <PYTHON_INSTALL_DIR>\Lib\site-packages\PyQt4. Use this batch to run your command.

    If you look into the content of the batch file you will see that it calls the Python interpreter with PyQt4\uic\pyuic.py and the given arguments.

    0 讨论(0)
  • 2021-01-18 05:21

    If you add <PYTHON_INSTALL_DIR>\Lib\site-packages\PyQt4 to you environment path you can run it from any directory by using c:\pyuic4 input.ui -o output.py

    0 讨论(0)
  • 2021-01-18 05:26

    sk11 is right. Do the following:

    • Go to <PYTHON_INSTALL_DIR>\Lib\site-packages\PyQt4.
    • There is a pyuic4.bat file in this directory. Copy your .ui file here.
    • In cmd, change the directory to <PYTHON_INSTALL_DIR>\Lib\site-packages\PyQt4.
    • Convert the .ui to .py file using pyuic4 -x name_of_ui_file.ui -o chosen_name.py.

    This is so basic but it works!

    0 讨论(0)
  • 2021-01-18 05:29

    In order to convert Qt-designer file.ui into file.py you need to call pyuic4.bat file.

    1. Go to python\Lib\site-package from command prompt.
    2. type pyuic4.bat -x file_location\file.ui -o file_location\file.py then Enter
    0 讨论(0)
提交回复
热议问题