2
我有一個python應用程序(主要是使用pyqt完成的)。我使用py2exe創建可執行文件,我的setup.py看起來像這樣在setup.py文件中複製整個文件夾
from distutils.core import setup import py2exe import os
includes=["sqlite3","sip","PyQt4","PyQt4.QtGui","PyQt4.QtCore"]
excludes=[]
packages=[]
dll_excludes=['libgdk-win32-1.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll']
setup(
options={"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 2,
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['myapplication.py'],
data_files = [('', [r'c:\configuration.ini',
r'c:readme.txt'
])]
)
現在data_files條目允許我幾個文件複製到「DIST」文件夾,但是我也想複製我的文檔文件夾中,文檔文件夾包含一大堆文件,html,圖像,pdf,大約2MB的文檔存儲在my_app \ docs文件夾中。我不知道如何做到這一點。誰能建議如何?
看看'shutil'包。 – fuesika