专栏首页python3python 将python程序编译成可

python 将python程序编译成可

一、使用pyinstaller 完成对python程序到可执行文件转换.

官网: http://www.pyinstaller.org/ 下载与操作系统相匹配的版本. 目前pyinstaller 只支持2.3 - 2.7。 不支持python.3

二、将下载的pyinstaller-2.0.zip文件解压,解压后可直接使用。

    pyinstaller不依赖python,因此不需要放入到 site-packages此目录.

三、pyinstaller 使用及参数

C:\pyinstaller-2.0>python pyinstaller.py -F -w --icon=E:\p_w_picpaths\96.ico MonitorWin32Process.py 
38 INFO: wrote C:\pyinstaller-2.0\MonitorWin32Process\MonitorWin32Process.spec 
60 INFO: Testing for ability to set icons, version resources... 
75 INFO: ... resource update available 
78 INFO: UPX is not available. 
1154 INFO: checking Analysis 
1156 INFO: building Analysis because out00-Analysis.toc non existent 
1157 INFO: running Analysis out00-Analysis.toc 
1159 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable 
 
1253 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21 
022.8_none ... 
1255 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc 
8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest 
1258 INFO: Searching for file msvcr90.dll 
1259 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_ 
9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll 
1259 INFO: Searching for file msvcp90.dll 
1261 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_ 
9.0.21022.8_none_bcb86ed6ac711f91\msvcp90.dll 
1262 INFO: Searching for file msvcm90.dll 
1264 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_ 
9.0.21022.8_none_bcb86ed6ac711f91\msvcm90.dll 
1365 INFO: Analyzing C:\pyinstaller-2.0\support\_pyi_bootstrap.py 
2440 INFO: Analyzing C:\pyinstaller-2.0\PyInstaller\loader\archive.py 
2552 INFO: Analyzing C:\pyinstaller-2.0\PyInstaller\loader\carchive.py 
2674 INFO: Analyzing C:\pyinstaller-2.0\PyInstaller\loader\iu.py 
2705 INFO: Analyzing MonitorWin32Process.py 
2779 WARNING: pywintypes is changing its name to pywintypes27 
2871 WARNING: pythoncom is changing its name to pythoncom27 
3535 INFO: Hidden import 'encodings' has been found otherwise 
3536 INFO: Looking for run-time hooks 
3537 INFO: Analyzing rthook C:\pyinstaller-2.0\support/rthooks/pyi_rth_encodings 
.py 
3621 INFO: Analyzing rthook C:\pyinstaller-2.0\support/rthooks/pyi_rth_versioned 
dll.py 
3723 INFO: Analyzing rthook C:\pyinstaller-2.0\support/rthooks/pyi_rth_win32comg 
enpy.py 
3833 INFO: Analyzing rthook C:\pyinstaller-2.0\support/rthooks/pyi_rth_versioned 
dll.py 
4118 INFO: Adding Microsoft.VC90.MFC to dependent assemblies of final executable 
 
4192 INFO: Searching for assembly x86_Microsoft.VC90.MFC_1fc8b3b9a1e18e3b_9.0.21 
022.8_none ... 
4193 INFO: Found manifest C:\Python27\lib\site-packages\Pythonwin\Microsoft.VC90 
.MFC.manifest 
4195 INFO: Searching for file mfc90.dll 
4196 INFO: Found file C:\Python27\lib\site-packages\Pythonwin\mfc90.dll 
4197 INFO: Searching for file mfc90u.dll 
4197 INFO: Found file C:\Python27\lib\site-packages\Pythonwin\mfc90u.dll 
4199 INFO: Searching for file mfcm90.dll 
4200 INFO: Found file C:\Python27\lib\site-packages\Pythonwin\mfcm90.dll 
4200 INFO: Searching for file mfcm90u.dll 
4202 INFO: Found file C:\Python27\lib\site-packages\Pythonwin\mfcm90u.dll 
4856 INFO: Warnings written to C:\pyinstaller-2.0\MonitorWin32Process\build\pyi. 
win32\MonitorWin32Process\warnMonitorWin32Process.txt 
4866 INFO: checking PYZ 
4867 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing 
4868 INFO: building PYZ out00-PYZ.toc 
6252 INFO: checking PKG 
6253 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing 
6253 INFO: building PKG out00-PKG.pkg 
8202 INFO: checking EXE 
8203 INFO: rebuilding out00-EXE.toc because MonitorWin32Process.exe missing 
8205 INFO: building EXE from out00-EXE.toc 
8212 INFO: SRCPATH [('E:\\p_w_picpaths\\96.ico', None)] 
8231 INFO: Updating icons from ['E:\\p_w_picpaths\\96.ico'] to c:\users\bo\appdata\loc 
al\temp\tmp827iux 
8232 INFO: Writing RT_GROUP_ICON 0 resource with 76 bytes 
8233 INFO: Writing RT_ICON 1 resource with 872 bytes 
8233 INFO: Writing RT_ICON 2 resource with 3240 bytes 
8235 INFO: Writing RT_ICON 3 resource with 7336 bytes 
8236 INFO: Writing RT_ICON 4 resource with 12840 bytes 
8236 INFO: Writing RT_ICON 5 resource with 28840 bytes 
8266 INFO: Appending archive to EXE C:\pyinstaller-2.0\MonitorWin32Process\dist\ 
MonitorWin32Process.exe 
 
C:\pyinstaller-2.0> 

正常情况下会在当前目录下,生成与python文件名相同的目录,可执行程序在dist 目录下.

-F 生成一个文件及生成一个exe文件 
-W --windowed, --noconsole 使用一个子系统,不使用console及没有那个黑框 
--icon 可自定义图标 

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Python开发规范及文件命名

    py3study
  • python-itchat 统计微信群、

    今天小编就为大家分享一篇python-itchat 统计微信群、好友数量,及原始消息数据的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

    py3study
  • Python 一个简单的读取excel例

    笔者安装了python3版本,然后IDE安装了Pycharm,感受一下python的开发环境

    py3study
  • eclipse中建geoserver源码

    概述:本文讲述的是在eclipse中如何构建geoserver源码工程,其中涉及到了jdk,github,marven等。

    lzugis
  • 使用fabric8-maven-plugin插件的错误处理(No plugin found for prefix 'fabric8')

    版权声明:欢迎转载,请注明出处,谢谢。 ...

    程序员欣宸
  • 使用Maven插件构建Spring Boot应用程序Docker镜像

    从构建日志中可以很清晰地看到,一开始下载Maven的依赖配置,随后就开始使用Dockerfile中的构建指令定制镜像,并且将项目根路径作为构建上下文。 另外,...

    2Simple
  • Python定时偷取妹子Chrome上网记录

    2、使用DB Browser把这个文件加进来,打开后可以看到表信息,这里用到的urls表中的url和last_visit_time字段

    未来sky
  • Maven部署Web项目到Tomcat的配置

    Maven自动部署实际上调的是Tomcat安装目录下的manager功能。而为了能正常访问http://localhost:8080/manager页面,我们需...

    用户3004328
  • deploy to heroku

    用户3004328
  • Hadoop基础教程-第13章 源码编译(13.3 HBase1.2.6源码编译)

    第13章 源码编译 13.3 HBase1.2.6源码编译 13.3.1 下载源码 https://mirrors.tuna.tsinghua.edu.cn/a...

    程裕强

扫码关注云+社区

领取腾讯云代金券