1.1 Write your own Flask
##1.2 Download pyinstallerpip install pyinstaller
Example | Description | |
---|---|---|
| pyinstaller -F demo.py
Only generates a program demo.exe file in the dist folder, suitable for a module without multiple dependency .py files |
|
| pyinstaller -D demo.py
The default option, in addition to the main program demo.exe, will also Many dependency files are generated in the dist folder. It is recommended to use this |
|
| pyinstaller -c demo.py Default option, only valid for windows, use the console |
|
| pyinstaller -w demo .py
is only valid for windows, does not use the console |
|
| pyinstaller -p D:\project\demo.py
Set import path |
|
# #pyinstaller -i D:\demo.ico demo.py |
Set a custom icon for the generated demo.exe file |
1.4 Run exe and test
# 到dist/run文件夹下,双击 run.exe,启动 如下图 # 浏览器访问 如下图
2. Use nsis The folder is packaged into a windows installation package
2.1 Download and install nsisnsis: NSIS (Nullsoft Scriptable Install System) is an open source installer production program for Windows systems. It provides installation, Uninstall, system settings, file decompression and other functions. As its name indicates, NSIS uses its scripting language to describe the behavior and logic of the installation program. Use nsis to package the run folder of dist into a windows installation package2.2 Compress the run folder under the dist folder into a zip
2.3 Use nsis to compress the package into a windows installation document
The above is the detailed content of How to package python projects into exe and installation packages. For more information, please follow other related articles on the PHP Chinese website!