有没有办法为py2exe指定构建目录
我可以dist
使用命令行设置py2exe的最终目录:
python setup.py py2exe -d "my/dist/dir"
但我似乎无法将文件设置为用于临时build
目录。我已经对源进行了简要介绍,但是除非我丢失了某些内容,否则似乎没有任何方法可以做到。
-
您可以在命令行上设置的任何选项都可以通过setup.cfg文件或setup.py文件进行设置。
-d
是一种快捷方式--dist-dir
,您可以将其添加到传递给setup的options关键字param的字典中的py2xe dict
'dist_dir'
:from distutils.core import setup import py2exe # equivalent command line with options is: # python setup.py py2exe --compressed --bundle-files=2 --dist-dir="my/dist/dir" --dll-excludes="w9xpopen.exe" options = {'py2exe': { 'compressed':1, 'bundle_files': 2, 'dist_dir': "my/dist/dir" 'dll_excludes': ['w9xpopen.exe'] }} setup(console=['myscript.py'], options=options)
您也可以将setup.cfg放在setup.py文件旁边:
[py2exe] compressed=1 bundle_files=2 dist_dir=my/dist/dir dll_excludes=w9xpopen.exe
build目录(
--build-base
)是build命令的一个选项,因此您可以将其添加到以下一个配置文件(或setup.py)中:[build] build_base=my/build/dir