# python-template **Repository Path**: At-ease/python-template ## Basic Information - **Project Name**: python-template - **Description**: python 基础框架 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-31 - **Last Updated**: 2026-11-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Python ## 2. 创建虚拟环境(标准命名 .venv 或 venv) ```bash python -m venv .venv ``` ## 3. 激活虚拟环境(注意:Windows 和 Mac/Linux 命令不同) ```bash # Windows (CMD): .venv\Scripts\activate # Windows (PowerShell): .\.venv\Scripts\Activate.ps1 # Mac / Linux: source .venv/bin/activate ``` ## 安装依赖 ```bash # 安装 pip install [依赖] # 导出 pip freeze > requirements.txt ``` ```bash # 新设备一键还原环境 pip install -r requirements.txt ``` ## 运行 ```bash # 设置 PYTHONPATH 让 Python 能找到 src 包,或者直接以模块方式运行 python -m src.main ``` ## 打包 ```bash pyinstaller --onefile main.py pyinstaller --onefile --noconsole main.py ``` --onefile (-F):将所有内容打包成单个 .exe 文件,分发更方便。 --noconsole (-w):隐藏命令行黑框,如果你的程序有图形界面(GUI),建议加上 更换图标:pyinstaller -F -w -i app.png main.py ## 数据库 [HeidiSQL 工具](https://www.heidisql.com/)