python2.6打包脚本备忘

from distutils.core import setup
import py2exe

setup(
options = {
"py2exe": {
"compressed": 1,
"optimize": 2,
"ascii": 0,
"bundle_files": 1
}
},
zipfile=None,
#windows=[{
#"script": "runapp.py",
# "icon_resources": [(1, "app.ico")]
#}],
console=["runapp.py",]
)
"""

C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the se
ts module is deprecated
import sets
Common commands: (see '--help-commands' for more)

setup.py build will build the package underneath 'build/'
setup.py install will install the package

Global options:
--verbose (-v) run verbosely (default)
--quiet (-q) run quietly (turns verbosity off)
--dry-run (-n) don't actually do anything
--help (-h) show detailed help message

Options for 'py2exe' command:
--optimize (-O) optimization level: -O1 for "python -O", -O2 for
"python -OO", and -O0 to disable [default: -O0]
--dist-dir (-d) directory to put final built distributions in (default
is dist)
--excludes (-e) comma-separated list of modules to exclude
--dll-excludes comma-separated list of DLLs to exclude
--ignores comma-separated list of modules to ignore if they are
not found
--includes (-i) comma-separated list of modules to include
--packages (-p) comma-separated list of packages to include
--compressed (-c) create a compressed zipfile
--xref (-x) create and show a module cross reference
--bundle-files (-b) bundle dlls in the zipfile or the exe. Valid levels
are 1, 2, or 3 (default)
--skip-archive do not place Python bytecode files in an archive, put
them directly in the file system
--ascii (-a) do not automatically include encodings and codecs
--custom-boot-script Python file that will be run when setting up the
runtime environment

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

"""

附:来自 http://blog.chinaunix.net/u/174/showart_1801802.html
py2exe编译wxpython时遇到的问题.
今天学着用wxpython写了个小程序,可是在用py2exe时遇到了麻烦,先是提示找不到MSVCP90.dll文件,放到程序目录下编译通过了,可是在本机可以运行,在别的机器上就无法运行了。原来需要在dist目录中加入:
Microsoft.VC90.CRT.manifest,msvcm90.dll,msvcp90.dll,msvcp90.dll四个文件。我在vs2008的目录Microsoft Visual Studio 9.0\VC\redist\x86中找到了它们。加上后就可以发布到别的机器上了。
环境:python 2.6, py2exe-0.6.9.win32-py2.6,wxPython2.8-win32-unicode-2.8.9.1。
还有就是运行程序里弹出dos窗口的问题,可以把py后缀改为pyw就行了。如果要是编译的话记住一定要用setup(windows = ['foo.py'])要是用setup(console=['foo.py'] )的话,还是会弹出窗口的。

参考文档:http://203.208.37.104/search?q=cache:KRPx2KVogmgJ:www.bbs.shu.edu.tw/bmore%3FTW_Python%26576+py2exe+MSVCP90.dll&hl=zh-CN&ct=clnk&cd=2&gl=cn&lr=lang_zh-CN|lang_zh-TW&st_usg=ALhdy28fjl7MyN61LvKzQj3kWDK7c7Ekwg

http://bytes.com/groups/python/854597-py2exe-users-py2exe-0-6-9-released
http://mail.python.org/pipermail/python-list/2004-June/268126.html

你可能感兴趣的:(随笔,脚本,Python,wxPython,OO,VC++)