繁体   English   中英

使用Py2exe将GUI转换为独立可执行文件时出错

[英]Error converting GUI to standalone executable using Py2exe

我使用py2exe将我的程序与多个GUI转换为独立的可执行文件。 我使用PyQt来创建GUI。 我运行的主要脚本实例化主UI,其中包含可以打开子UI的按钮,选项卡等。 主脚本是main_ui.py

我按照教程如何使用py2exe ,所以我有以下setup.py

from distutils.core import setup
import py2exe

setup(windows=['main_ui.py'])

然后,在CMD中: > python setup.py py2exe

我尝试使用简单的脚本创建一个练习exe,一切正常。 但是,当我尝试从main_ui.py创建exe时出现错误。

这是输出:

L:\internal\(path)>python setup.py py2exe
running py2exe
creating L:\internal\(path)\build
creating L:\internal\(path)\build\bdist.win32
creating L:\internal\(path)\build\bdist.win32\winexe
creating L:\internal\(path)\build\bdist.win32\winexe\collect-2.7
creating L:\internal\(path)\build\bdist.win32\winexe\bundle-2.7
creating L:\internal\(path)\build\bdist.win32\winexe\temp
creating L:\internal\(path)\dist
*** searching for required modules ***
error: compiling 'C:\Python27\lib\site-packages\PyQt4\uic\port_v3\proxy_base.py' failed
SyntaxError: invalid syntax <proxy_base.py, line 26>

这是proxy_base.py

from PyQt4.uic.Compiler.proxy_metaclass import ProxyMetaclass


class ProxyBase(metaclass=ProxyMetaclass):
""" A base class for proxies using Python v3 syntax for setting the
meta-class.
"""

PyQt4附带了这个; 有谁知道发生了什么? 这是将我的程序变成可执行文件的正确方法吗?

我遇到了同样的问题。 可能有更好的方法,但删除文件夹“PyQt4 \\ uic \\ port_v3”解决了这个问题。

(见http://python.6.x6.nabble.com/PyQt-4-7-and-py2exe-error-td1922933.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM