我有兴趣将我的项目中的文件复制到CX_Freeze文件夹,使用include_files方法可以将文件带到项目中,但我不知道怎么做才能将它带出来。
我生成一个.exe安装程序,它在Program Files中安装程序,并且我必须手动将文件复制到特定目录,我希望能够在安装它的同时完成它。
简而言之,我想要做的是从 my_project/path/to/archive
复制到 C:\Windows\SysWOW64
我分享到目前为止我的设置
setup.py
from cx_Freeze import setup, Executable
import sys
base = 'Win32GUI' if sys.platform == 'win32' else None
import os
os.environ['TCL_LIBRARY'] = r"C:\Users\puig\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"C:\Users\puig\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6"
shortcut_table = [
("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"ScannerApp Connector", # Name
"TARGETDIR", # Component_
"[TARGETDIR]connector.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # WkDir
)
]
msi_data = {'Shortcut': shortcut_table}
bdist_msi_options = {'data': msi_data}
options = {
'build_exe': {
'include_files': [
'my_project/GUI/templates',
'my_project/GUI/images',
'my_project/agent/config.cfg',
os.path.join(sys.base_prefix, 'DLLs', 'sqlite3.dll'),
os.path.join(sys.base_prefix, 'DLLs', 'tk86t.dll'),
os.path.join(sys.base_prefix, 'DLLs', 'tcl86t.dll'),
],
'packages': [
'PyQt5.uic',
'PyQt5.QtGui',
'PyQt5.QtWidgets',
'PyQt5.QtCore',
'PIL',
'zmq',
'os',
'tkinter',
'raven',
],
'excludes': [
'django',
'Image',
'PyQt5.Qt',
],
},
'bdist_msi': bdist_msi_options,
}
executables = [
Executable(script='my_project/GUI/GUI.py', base=base),
Executable(script='my_project/agent/connector.py', base=base)
]
setup(
name='x',
version='0.2.9a0',
description='description',
options=options,
executables=executables,
author='x',
license='MIT',
skip_build=True
)
有什么想法吗?
THX。