利用pyinstaller发布不依赖python解释器的可执行exe

现在打包app.py,从Windows命令提示符(cmd)运行:

pyinstaller.exe --onefile --windowed app.py

就这么简单。

如果打包成功,最终的可执行文件app.exe和任何相关文件将放在dist目录中,如果该目录不存在,将创建该目录。

 

 

PyInstaller Manual

Version

PyInstaller 5.1

Homepage

https://pyinstaller.org/

Contact

pyinstaller@googlegroups.com

Authors

David Cortesi, based on structure by Giovanni Bajo & William Caban, based on Gordon McMillan’s manual

Copyright

This document has been placed in the public domain.

PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules. PyInstaller supports Python 3.7 and newer, and correctly bundles many major Python packages such as numpy, matplotlib, PyQt, wxPython, and others.

PyInstaller is tested against Windows, MacOS X, and Linux. However, it is not a cross-compiler; to make a Windows app you run PyInstaller on Windows, and to make a Linux app you run it on Linux, etc. x PyInstaller has been used successfully with AIX, Solaris, FreeBSD and OpenBSD but testing against them is not part of our continuous integration tests, and the development team offers no guarantee (all code for these platforms comes from external contributions) that PyInstaller will work on these platforms or that they will continue to be supported.

Quickstart

Make sure you have the Requirements installed, and then install PyInstaller from PyPI:

pip install -U pyinstaller

Open a command prompt/shell window, and navigate to the directory where your .py file is located, then build your app with the following command:

pyinstaller your_program.py

Your bundled application should now be available in the dist folder.

 

 

posted @   bonelee  阅读(228)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
历史上的今天:
2021-06-02 RBF(径向基)神经网络——原来本质就是利用高斯核函数去做函数逼近,类似泰勒展开
2020-06-02 小样本学习年度进展|VALSE2018
2018-06-02 PCA算法详解——本质上就是投影后使得数据尽可能分散(方差最大),PCA可以被定义为数据在低维线性空间上的正交投影,这个线性空间被称为主⼦空间(principal subspace),使得投影数据的⽅差被最⼤化(Hotelling, 1933),即最大方差理论。
2017-06-02 elasticsearch 索引搜索和索引性能优化配置——思路:去掉不必要的数据,减小数据的磁盘空间占用,同时提升性能
2017-06-02 python统计ES存储空间占用的代码
点击右上角即可分享
微信分享提示