问题
I created a new script with cx_freeze's template. Then I'm running python setup.py build
to create the exe. If I move main.exe
to the root folder cx_freeze test
it will fail to run.
All I want is to move .exe up 1 or two directories. Here's my code:
main.py
foo = input("Complete")
setup.py:
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(
packages = [],
excludes = [],
includes = ["atexit"]
)
# include_files=[]
base = 'Console'
executables = [
Executable('main.py', base=base, targetName = 'main.exe')
]
setup(name='freeze test',
version = '1',
description = '.',
options = dict(build_exe = buildOptions),
executables = executables)
I thought http://cx-freeze.readthedocs.org/en/latest/faq.html#using-data-files might have some help, but since the files are in the subdirectory, I can't use os
module?
回答1:
That feature is not available in 4.x but will be available in 5.x when it is made available. The current source has this capability so if you can compile it you can have it today; otherwise, you'll need to wait for the official release which I hope will be soon.
来源:https://stackoverflow.com/questions/36273298/creating-exe-using-cx-freeze-but-move-exe-to-root-directory-to-deploy