7

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

it just givet me this error

C:\Windows\system32>pyuic4 'pyuic4' is not recognized as an internal or external command, operable program or batch file.

I actually dont't know where the pyuic file should be located, should PyQt, be located within the Python files or something?

Please Help

RasmusGP
  • 4,696
  • 5
  • 21
  • 28

4 Answers4

12

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.

sk11
  • 1,779
  • 1
  • 17
  • 29
  • Wait, so it installs itself? i just found a zip file that i have to extract ?? – RasmusGP Sep 17 '14 at 06:14
  • 1
    No first you have to install PyQt4, if you haven't done so. Check [PyQt4](http://sourceforge.net/projects/pyqt/) – sk11 Sep 17 '14 at 06:17
  • I short modification to your answer ... Instead of saying "When you install PyQt, it gets install under Python's site-packages.", it should be, "Install PyQT under your existing Python installation directory e.g. C:\Python\Python3.5". Because, my Python was not installed in C drive – Ali Mar 28 '16 at 11:08
  • If you installed pyside, then it's `pyside-uic.exe` – Smit Johnth Jul 13 '16 at 00:36
5

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

Jason Callahan
  • 505
  • 5
  • 7
0

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
Rohan
  • 1
0

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!

Pang
  • 9,564
  • 146
  • 81
  • 122