PyQt5 pyuic Import error: DLL load failed

早过忘川 提交于 2019-12-13 02:37:01

问题


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?


回答1:


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




回答2:


I had a very similar problem, on windows 10 x64 and Python3.5. I could fix it by simply installing an older version, namely Pyqt5-5.9.

You need to uninstall Pyqt5, pyqt5-sip and pyqt5-tools and then re-install pyqt5-5.9. The following code can do the job:

pip uninstall pyqt5
pip uninstall pyqt5-sip
pip uninstall pyqt5-tools

and the the installation:

pip install pyqt5 == 5.9

pip install pyqt5-tools



来源:https://stackoverflow.com/questions/47739191/pyqt5-pyuic-import-error-dll-load-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!