Cx Freeze - 如何将多个文件转换为构建文件夹
Cx Freeze - how do I convert multiple files into the build folder
我制作了一个程序,它使用 os.startfile()
启动另一个 python 程序。
我想把它作为两个 exe
文件,使用 subprocess.call()
启动第二个文件,在 1 个构建文件夹中,但我找不到如何执行此操作。
我尝试为两者创建一个安装文件,创建 2 个构建文件夹,然后将 exe
文件中的 1 个复制到另一个的构建文件夹中,但得到了这个:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12,
in <module> __import__(name + "__init__")
ImportError: No module named 'menu_record__init__'
有什么想法吗?
我很确定你不能在一个构建文件夹中使用两个 exe,因为尽管构建文件夹中的所有依赖项都是相同的,但脚本是不同的。
您可以使用此脚本在同一个构建文件夹中获取两个 exe。
import sys
from cx_Freeze import setup, Executable
options = {
'build_exe': {'path': sys.path + ['modules']}
}
executables = [
Executable('script_1.py'),
Executable('script_2.py')]
setup(
name='two exe in one folder',
version='0.1',
description='Two exe in a single build folder',
options=options,
executables=executables)
看看这个 post 我
您也可以复制第一个中的第二个构建文件夹(您需要将其重命名为其他不构建的文件夹)并调用 subprocess.call() 到第二个构建文件 exe。
另外我听说(虽然没试过)pyinstaller或者py2exe(我不确定哪个)可以把单个文件做成exe。
我制作了一个程序,它使用 os.startfile()
启动另一个 python 程序。
我想把它作为两个 exe
文件,使用 subprocess.call()
启动第二个文件,在 1 个构建文件夹中,但我找不到如何执行此操作。
我尝试为两者创建一个安装文件,创建 2 个构建文件夹,然后将 exe
文件中的 1 个复制到另一个的构建文件夹中,但得到了这个:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12,
in <module> __import__(name + "__init__")
ImportError: No module named 'menu_record__init__'
有什么想法吗?
我很确定你不能在一个构建文件夹中使用两个 exe,因为尽管构建文件夹中的所有依赖项都是相同的,但脚本是不同的。
您可以使用此脚本在同一个构建文件夹中获取两个 exe。
import sys
from cx_Freeze import setup, Executable
options = {
'build_exe': {'path': sys.path + ['modules']}
}
executables = [
Executable('script_1.py'),
Executable('script_2.py')]
setup(
name='two exe in one folder',
version='0.1',
description='Two exe in a single build folder',
options=options,
executables=executables)
看看这个 post 我
您也可以复制第一个中的第二个构建文件夹(您需要将其重命名为其他不构建的文件夹)并调用 subprocess.call() 到第二个构建文件 exe。
另外我听说(虽然没试过)pyinstaller或者py2exe(我不确定哪个)可以把单个文件做成exe。