消防设备网站建设,安徽建设教育协会网站,网络营销管理系统,小程序开发文档api分类#xff1a;Python #xff5c; 作者#xff1a;凹凸曼 #xff5c; 发表于2011/03/01Python怎样打包成exe#xff1f;已关闭评论
发现PyInstaller 是个不错的东东#xff0c;解决打包单个exe的问题#xff0c;使用非常简单#xff0c;不用编写setup脚本#xff1…分类Python 作者凹凸曼 发表于2011/03/01Python怎样打包成exe已关闭评论
发现PyInstaller 是个不错的东东解决打包单个exe的问题使用非常简单不用编写setup脚本
进入开发目录执行命令行可以做个bat文件
引用
python d:\pyinstaller-1.3\configure.py
python d:\pyinstaller-1.3\Makespec.py client.py –onefile –windowed –iconclient.ico
python d:\pyinstaller-1.3\build.py client.spec
就这样一个单独的client.exe就产生了不到3M是压缩前的三分之一如果用wxpython大概会有6M多py2exe压缩的单个exe也差不多这个大小但py2exe并没有把所有的dll打包。pyinstaller打包比较彻底就只有一个exe文件。
生成完后同时有个警告文件内容是
引用
W: no module named posix (conditional import by os)
W: no module named optik.__all__ (top-level import by optparse)
W: no module named pwd (delayed, conditional import by posixpath)
W: no module named MacOS (top-level import by Tkinter)
W: no module named posix (delayed, conditional import by iu)
W: no module named org (top-level import by copy)
W: no module named _emx_link (conditional import by os)
W: no module named optik.__version__ (top-level import by optparse)
W: __all__ is built strangely at line 0 – __future__ (C:\Python25\lib\__future__.pyc)
W: delayed __import__ hack detected at line 0 – encodings (C:\Python25\lib\encodings\__init__.pyc)
W: delayed exec statement detected at line 0 – Tkinter (C:\Python25\lib\lib-tk\Tkinter.pyc)
W: __all__ is built strangely at line 0 – optparse (d:\pyinstaller-1.3\optparse.pyc)
W: delayed exec statement detected at line 0 – socket (C:\Python25\lib\socket.pyc)
W: delayed eval hack detected at line 0 – os (C:\Python25\lib\os.pyc)
W: __all__ is built strangely at line 0 – tokenize (C:\Python25\lib\tokenize.pyc)
W: delayed conditional exec statement detected at line 0 – iu (d:\pyinstaller-1.3\iu.pyc)
W: delayed conditional exec statement detected at line 0 – iu (d:\pyinstaller-1.3\iu.pyc)
W: delayed eval hack detected at line 0 – gettext (C:\Python25\lib\gettext.pyc)
W: delayed __import__ hack detected at line 0 – optik.option_parser (d:\pyinstaller-1.3\optik\option_parser.pyc)
W: delayed conditional eval hack detected at line 0 – warnings (C:\Python25\lib\warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 – warnings (C:\Python25\lib\warnings.pyc)
W: __all__ is built strangely at line 0 – optik (d:\pyinstaller-1.3\optik\__init__.pyc)
不影响程序使用。
打赏作者
支持:
微信支付
支付宝
您的支持将鼓励我们继续创作用 [微信] 扫描二维码打赏用 [支付宝] 扫描二维码打赏
正在跳转到PayPal...