0

我试图创建我的 File NewExistGUI2.py的可执行文件,其中 GUI 是使用 wxpython 制作的。该文件取决于其他两个文件localsettings.pyTryone.py。我参考了 py2exe 文档,并创建了一个setup.py文件:

from distutils.core import setup    
import py2exe

    setup(name = 'python eulexistdb module',
        version = '1.0',
        description = 'Python eXistdb communicator using eulexistdb module',
        author = 'Sarvagya Pant',
        py_modules = ['NewExistGUI2','localsettings','Tryone']
        )

并使用在命令行中编译程序

python setup.py py2exe

但是我没有在dist文件夹中创建主程序 NewExistGUI2.py 的任何 .exe 文件。我现在该怎么办?

4

1 回答 1

1

我建议您创建一个具有以下结构的模块(ExistGUI):

ExistGUI
\_ __init__.py
|_ localsettings.py
|_ Tryone.py
bin
\_ NewExistGUI2.py

你的init .py 应该有:

from . import localsettings, Tryone

__version__ = 1.0

您的 setup.py 应该类似于:

from setuptools import setup, find_packages
import ExistGUI
import py2exe

setup(
     name = 'ExistGUI',
     version = ExistGUI.__version__,
     console=['bin/NewExistGUI2.py'],
     description = 'Python eXistdb communicator using eulexistdb module',
     author = 'Sarvagya Pant',
     packages= find_packages(),
     scripts=['NewExistGUI2.py',],
     py_modules = ['localsettings','Tryone'],
     include_package_data=True,
     zip_safe=False,
)

然后运行 ​​python setup.py py2exe。确保在 setup.py 中包含对模块的任何要求。另外,删除之前生成的 dist 目录,以防万一。

希望这可以帮助。

于 2013-08-29T17:25:03.093 回答