Search code examples
pythonpyqtpyuic

PyQt5 pyuic Import error: DLL load failed


I have downloaded python 3.6.2 from python.org and pyqt 5.9.2 using pip to install but I am having a problem when converting code from .ui to .py

C:\Users\pc\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pyqt5-tools>pyuic5 -x satesto.ui -o satesto.py
Traceback (most recent call last):
  File "c:\users\pc\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\pc\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pyqt5-tools\pyuic5.exe\__main__.py", line 5, in <module>
  File "c:\users\pc\appdata\local\programs\python\python36-32\lib\site-packages\PyQt5\uic\pyuic.py", line 26, in <module>
    from PyQt5 import QtCore
ImportError: DLL load failed: The specified procedure could not be found.

It says that dll load is failed when typing from PyQt5 import QtCore but when I type it in basic python it works without a problem. Do anyone know what could be the problem or how can it be solved?


Solution

  • You can follow these steps(Windows 8 or 10 User) to accomplish the converting from .ui to .py

    1. Open the folder Python36\Scripts

    2. Click shift key anywhere in the window and then select PowerShell

    3. Write pyuic5 -x the place where you have saved ui data -o name.py

      example: pyuic5 -x C:\User\Documents\MyPython\MyGui.ui -o MyGui.py

    4. You will find MyGui.py in Scripts of the Python36