当前位置:网站首页 > 技术博客 > 正文

py2exe原理




 

hello.py

C:Tutorial>python hello.py Hello World! C:Tutorial>
C:Tutorial>python setup.py install
  1. 在py2exe 下工作时,我们通常需要的 Distutils 的唯一部分就是 setup 函数,所以我们导入它。
  2. 一旦Distutils 加载完成,我们还需要加载 py2exe 以至于加载它的命令。
  3. 空一行总是好的!
  4. 调用 setup 告诉它我们想要一个单控制台应用程序,并且主入口是 "hello.py"。
C:Tutorial>python setup.py py2exe running py2exe * searching for required modules * * parsing results * creating python loader for extension 'zlib' creating python loader for extension 'unicodedata' creating python loader for extension 'bz2' * finding dlls needed * * create binaries * * byte compile python files * byte-compiling C:Tutorialbuildbdist.win32winexe empbz2.py to bz2.pyc byte-compiling C:Tutorialbuildbdist.win32winexe empꋸdedata.py to unicodedata.pyc byte-compiling C:Tutorialbuildbdist.win32winexe empzlib.py to zlib.pyc skipping byte-compilation of c:Python24libStringIO.py to StringIO.pyc [skipping many lines for brevity] skipping byte-compilation of c:Python24libwarnings.py to warnings.pyc * copy extensions * * copy dlls * copying c:Python24libsite-packagespy2exe un.exe -> C:Tutorialdisthello.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. ADVAPI32.dll - C:WINDOWSsystem32ADVAPI32.dll USER32.dll - C:WINDOWSsystem32USER32.dll SHELL32.dll - C:WINDOWSsystem32SHELL32.dll KERNEL32.dll - C:WINDOWSsystem32KERNEL32.dll C:Tutorial>
C:Tutorial>cd dist C:Tutorialdist>hello.exe Hello World

版权声明


相关文章:

  • 什么是序列化与反序列化2025-04-05 17:01:03
  • 批处理命令大全及用法2025-04-05 17:01:03
  • 安装程序2503错误2025-04-05 17:01:03
  • getchar在c语言中怎么用2025-04-05 17:01:03
  • python xlwt读取excel2025-04-05 17:01:03
  • uboot命令的功能2025-04-05 17:01:03
  • ifndef/define/endif2025-04-05 17:01:03
  • matlab函数操作2025-04-05 17:01:03
  • plantuml github2025-04-05 17:01:03
  • pytest与unittest区别2025-04-05 17:01:03