gpt4 book ai didi

python - cx_Freeze与/使用相同库的多个exe

转载 作者:行者123 更新时间:2023-12-02 10:58:34 24 4
gpt4 key购买 nike

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

File "C:\Python\lib\site-packages\cx_Freeze\initscripts__startup__.py", line 13, in run module = import(name + "init") ModuleNotFoundError: No module named '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)
)

最佳答案

解:

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

关于python - cx_Freeze与/使用相同库的多个exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52576093/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com