chore: 开发脚本自动进入虚拟环境

This commit is contained in:
Nixevol
2026-07-13 16:28:08 +08:00
parent 182f0e5612
commit 3c74f03e7e
4 changed files with 57 additions and 10 deletions
+6 -6
View File
@@ -7,16 +7,16 @@
首次运行前:
```bash
python -m venv .venv
.\.venv\Scripts\activate
python -m pip install -r scripts/requirements.txt
python scripts/dev.py --install
python scripts/dev.py
```
如果 PowerShell 阻止激活脚本,可在当前终端临时放行后再激活:
`dev.py` 会先检查当前 Python 是否已在虚拟环境中;若没有,会自动复用项目根目录的 `.venv`/`venv`;若两者都不存在,会创建 `.venv` 并安装 `scripts/requirements.txt`,随后用虚拟环境 Python 重新执行当前命令。
```bash
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\activate
python scripts/dev.py --install # 首次:安装 pnpm 依赖 + 启动
python scripts/dev.py --no-seed # 跳过种子数据
python scripts/dev.py --install-mode # 调试首次安装向导
```
| 脚本 | 作用 |