[英]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
我已经使用 pip 从 python.org 下载了python 3.6.2
和pyqt 5.9.2
进行安装,但是在将代码从.ui
转换为.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.它说从 PyQt5 import QtCore
键入时 dll 加载失败,但是当我在基本 python 中键入它时,它可以正常工作。 Do anyone know what could be the problem or how can it be solved?有谁知道可能是什么问题或如何解决?
You can follow these steps(Windows 8 or 10 User) to accomplish the converting from .ui to .py您可以按照以下步骤(Windows 8 或 10 用户)完成从 .ui 到 .py 的转换
Open the folder Python36\\Scripts打开文件夹 Python36\\Scripts
Click shift key anywhere in the window and then select PowerShell单击窗口中任意位置的 shift 键,然后选择 PowerShell
Write pyuic5 -x
the place where you have saved ui data -o name.py在保存ui数据的地方写pyuic5 -x
-o name.py
example: pyuic5 -x C:\\User\\Documents\\MyPython\\MyGui.ui -o MyGui.py
示例: pyuic5 -x C:\\User\\Documents\\MyPython\\MyGui.ui -o MyGui.py
You will find MyGui.py in Scripts of the Python36你会在 Python36 的脚本中找到 MyGui.py
I had a very similar problem, on windows 10 x64 and Python3.5.我在 Windows 10 x64 和 Python3.5 上遇到了非常相似的问题。 I could fix it by simply installing an older version, namely Pyqt5-5.9.我可以通过简单地安装一个旧版本,即 Pyqt5-5.9 来修复它。
You need to uninstall Pyqt5, pyqt5-sip and pyqt5-tools and then re-install pyqt5-5.9.您需要卸载 Pyqt5、pyqt5-sip 和 pyqt5-tools,然后重新安装 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.