juechafun/05-原子化笔记本/Python-打包为可执行文件.md

54 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
#领域/Python
#复盘/1
## 一句话描述
[___pyinstaller的基础使用_____]
---
## 核心规范
>空想不如行动,积累胜于苛求。
>实践 > 沉淀 > 完美主义
实践不是盲目行动,而是带着“小目标、可验证“的方向试错,实践后必须沉淀(比如记录问题、总结规律),否则就是低水平重复。
实践大于沉淀,沉淀大于完美;完美是沉淀的终局方向,沉淀是实践的复盘产物;分域施策,避坑落地,始于行动,终于迭代。
---
## 三省沉淀法
- 达成了[__将Python程序打包成可执行文件______]目标
- 遇到了[__无法跨平台打包______]问题
- 下次改进[__严格控制最终打包环境、_使用 nuitka 打包_____]
## 个人理解
[__生成可执行不可查看文件______]
## 实践计划
1. [__明确解释器可运行情况例如 python main.py______]
2. [__pyinstall 打包情况、nuitka 编译情况、使用go语言开发情况______]
## 核心定义
```bash
pip install pyinstaller # 重新安装 PyInstaller
pip install nuitka
```
```bash
pyinstaller --onefile --windowed main.py
# Nuitka 生成的程序运行时**不依赖 Python 解释器**,是真正的原生可执行文件
nuitka --standalone --mingw64 main.py
```