使用cx_freeze创建exe,但将exe移至根目录以进行部署 [英] creating exe using cx_freeze, but move exe to root directory to deploy
问题描述
我使用cx_freeze的模板创建了一个新脚本。然后,我运行 python setup.py build
创建exe。如果将 main.exe
移至根文件夹 cx_freeze test
,它将无法运行。
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.
我只想将.exe移至1或2个目录。
这是我的代码:
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)
我认为 http:/ /cx-freeze.readthedocs.org/en/latest/faq.html#using-data-files 可能会有帮助,但是由于文件位于子目录中,因此我不能使用 os
模块?
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?
推荐答案
该功能我s在4.x中不可用,但在5.x中可用时将可用。当前的源代码具有此功能,因此,如果可以编译,则今天就可以拥有。否则,您需要等待正式发行,希望很快。
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.
这篇关于使用cx_freeze创建exe,但将exe移至根目录以进行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!