cx-冻结带有相同库的多个exe

时间:2018-09-30 08:24:32

标签: python compiler-errors cx-freeze

我有3个PY文件可以使用cx-Freeze进行编译。编译成功,但似乎每个步骤都会覆盖一些内容,这意味着只有最后一次编译才能正常运行(3/3)。一个接一个地执行前两个,不会出现该错误,并且它们将按预期运行。所有3个脚本都共享一些库。我想念什么?

  

文件   “ C:\ Python \ lib \ site-packages \ cx_Freeze \ initscripts__startup __。py”,   13行       module = 导入(名称+“ init ”)ModuleNotFoundError:没有名为'scriptName__init__'的模块

setup.py:

buildOptions = dict(excludes = ['matplotlib', 'PyQt4', 'PySide2'],
                    includes = ['urllib3', 'ibapi', 'idna.idnadata', 'numpy.core._methods', 'pandas'],
                    optimize = 1,
                    packages = ['pkg_resources._vendor'],
                )

for fName in glob.glob('*.py')[:-1]:
    nameDesc = fName.split('.')[0]
    setup(
        name = nameDesc,
        version = "0.1",
        description = nameDesc,
        executables = [Executable(script = fName)],
        options = dict(build_exe = buildOptions)
    )

1 个答案:

答案 0 :(得分:0)

解决方案:

setup(
    name = 'Proj',
    version = '0.1',
    description = 'Proj',
    executables = [Executable(i) for i in glob.glob('*.py')],
    options = dict(build_exe = buildOptions),
)