py2exe
を使用して、複数のGUIを持つプログラムをスタンドアロンの実行可能ファイルに変換しています。 PyQtを使ってGUIを作成しました。私が実行するメインスクリプトは、サブUIを開くことができるボタン、タブなどを含むメインUIをインスタンス化します。主なスクリプトはmain_ui.py
です。Py2exeを使用してGUIをスタンドアロンの実行可能ファイルに変換する際のエラー
私は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に付属しています。誰が何が起こっているのか分かりますか?これは私のプログラムを実行可能ファイルにする正しい方法ですか?