将 .ui 文件转换为 .py 文件时出错 [英] Error converting .ui file to .py file

查看:86
本文介绍了将 .ui 文件转换为 .py 文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Qt4 Designer 中创建了 notepad.ui 文件,并尝试通过命令创建 notepadwindow.py 文件

I created notepad.ui the file in Qt4 Designer and tried to create the notepadwindow.py file by means of a command

pyuic4.bat notepad.ui -o notepadwindow.py

结果我得到了以下错误

Traceback (most recent call):
  File "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py" line 31, in <module>
    from PyQt4 import QtCore
Import Error: DLL load failed: %1 then something strange on a different encoding Win32. 

推荐答案

我遇到了同样的错误并且能够解决它.

I experienced with the same error and was able to solve it.

虽然我在 64 位 Windows 上工作,但我的 python shell (2.7.11) 和所有扩展包都是 32 位的,它们运行良好.我遇到了很多错误,因为我下载的 PyQt4 是 64 位的.当我删除它并安装 32 位 PyQt4 时,问题就消失了,现在我可以将 .ui 文件转换为 .py

Although I work on a 64-bit Windows, my python shell (2.7.11) and all extension packages are 32-bit and they work well. I faced with many errors because my PyQt4 that i downloaded was 64-bit. When i remove it and install 32-bit PyQt4 the problem is gone and now i am able to convert .ui files to .py

也许你的问题和我一样,反之亦然,但 idle 和 PyQt 的版本应该匹配,32 位或 64 位.

Maybe your problem is the same with me or visa versa, but the versions of both idle and PyQt should match, either 32 or 64-bit.

这篇关于将 .ui 文件转换为 .py 文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆