Py2exe,Python转换为exe可执行文件,脱离Python运行环境运行


官方网站 http://www.py2exe.org/ 很奇怪的站点 一半中文一半英文,不知道是不是作者是中国人。

我使用的是Python2.6,于是下载了一个Python2.6的文件安装测试了一下 http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.6.exe/download

话说这个东西已经2,3年没更新了.

再同一级别目录下面新建一个setup.py

开始编译

[text]setup.py py2exe[/text]

[text]
running py2exe
*** searching for required modules ***
*** parsing results ***
creating python loader for extension 'select' (E:\Python26\DLLs\select.pyd -> select.pyd)
creating python loader for extension 'unicodedata' (E:\Python26\DLLs\unicodedata.pyd -> unicodedata.pyd)
creating python loader for extension 'bz2' (E:\Python26\DLLs\bz2.pyd -> bz2.pyd)
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
byte-compiling C:\Downloads\build\bdist.win32\winexe\temp\bz2.py to bz2.pyc
byte-compiling C:\Downloads\build\bdist.win32\winexe\temp\select.py to select.pyc
byte-compiling C:\Downloads\build\bdist.win32\winexe\temp\unicodedata.py to unicodedata.pyc
skipping byte-compilation of E:\Python26\lib\StringIO.py to StringIO.pyc
#略过
skipping byte-compilation of E:\Python26\lib\warnings.py to warnings.pyc
*** copy extensions ***
*** copy dlls ***
copying E:\Python26\lib\site-packages\py2exe\run.exe -> C:\Downloads\dist\hello.exe

*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.

Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.

WSOCK32.dll - C:\WINDOWS\system32\WSOCK32.dll
USER32.dll - C:\WINDOWS\system32\USER32.dll
ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll
SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll
KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll
[/text]

编译生成的文件在dist里面,里面有现成的二进制运行库,我看了一下,体积不小哦。

官方Tutorial: http://www.py2exe.org/index.cgi/Tutorial

参考:http://blog.csdn.net/suiyunonghen/archive/2009/03/29/4033076.aspx

Author Info :
  • From:Py2exe,Python转换为exe可执行文件,脱离Python运行环境运行
  • URL:http://blog.ihipop.info/2011/02/2102.html
  • Please Reserve This Link,Thanks!
  • 《Py2exe,Python转换为exe可执行文件,脱离Python运行环境运行》有6个想法

    1. 和中国人一点关系没有,仅仅是这个站的建站系统(The MoinMoin Wiki Engine)对国际化支持比较好而已。

    发表评论

    电子邮件地址不会被公开。 必填项已用*标注