1.1 Write your own Flask
pip 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.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!