我一直在尝试设置 PySide/Qt 以与 Python3.3 一起使用。我已经安装了
PySide-1.2.0.win32-py3.3.exe
我从 here 中获取的我已经安装了
qt-win-opensource-4.8.5-vs2010
我从 here 中获取的.
我使用 pyside-uic.exe
从 .ui
文件(我使用 QtDesigner 制作)生成了 .py
文件 as is explained in PySide Wiki .
当我使用 Qt5.1/QtCreator 时,制作 .py
文件是可行的。发现需要用Qt4.8就停止使用了as explained on Qt-forums .对于 Qt4.8,它不起作用。
- 我想使用 PySide 开发 GUI。
- 我想要一个拖放界面来制作框架 GUI,所以我使用 QtDesigner。
- 我使用的是 Windows 7
我想用cx-freeze把开发好的GUI打包成.exe文件。
简而言之我的问题
使用 QtDesigner 制作 .ui
的正确工具是什么?如何使用 PySide 将它们转换为 .py
文件以便在 Python 中使用?
cx_freeze 可以把我的普通文件转成.exe
可以用来把Qt/PySide 制作的GUI 转成.exe
文件吗?在分发了 GUI 的 .exe
的其他计算机上是否需要 Qt 还是它是独立的?
我用过
cxfreeze testGUI.py --include-modules=PySide
制作exe及相关文件。创建了包含许多文件的目录 dist
。运行时什么也没发生。所以我使用命令行找出原因。错误是
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\cx_Freeze\initscripts\Console3.py", line 27, in <module>
exec(code, m.__dict__)
File "testGUI.py", line 12, in <module>
File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1558, in _find_and_load
File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1525, in _find_and_load_unlocked
File "C:\Python33\lib\site-packages\PySide\__init__.py", line 55, in <module>
_setupQtDirectories()
File "C:\Python33\lib\site-packages\PySide\__init__.py", line 11, in _setupQtDirectories
pysideDir = _utils.get_pyside_dir()
File "C:\Python33\lib\site-packages\PySide\_utils.py", line 87, in get_pyside_dir
return _get_win32_case_sensitive_name(os.path.abspath(os.path.dirname(__file__)))
File "C:\Python33\lib\site-packages\PySide\_utils.py", line 83, in _get_win32_case_sensitive_name
path = _get_win32_long_name(_get_win32_short_name(s))
File "C:\Python33\lib\site-packages\PySide\_utils.py", line 58, in _get_win32_short_name
raise WinError()
FileNotFoundError: [WinError 3] The system cannot find the path specified.
有人知道这个堆栈跟踪是什么意思吗?
这里有很多win32
。但我有 Windows 7 64 位。我正在使用 32 位 Python,并且所有模块都安装为 32 位。这会导致问题吗?我认为它不应该,因为我为简单的 Python 脚本制作的其他 exe 执行得很好。
最佳答案
这个错误:
FileNotFoundError: [WinError 3] The system cannot find the path specified.
将在下一个 pyside 版本 (1.2.1) 中修复。它将在下周发布。
顺便说一句:如果您不想生成自定义绑定(bind),则不需要安装 qt,pyside 安装程序包含所有 qt 库和开发工具。
关于python - 为 GUI 开发设置 PySide/Qt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17787315/