开发
约 472 字大约 2 分钟
2026-08-12
EuoraCraft Launcher 由 Python 后端、frontend 前端子模块和 ECL/game Core 子模块组成。克隆项目时必须同时拉取子模块。
环境要求
| 工具 | 版本 |
|---|---|
| Python | 3.11 或更高,推荐 3.12 |
| Node.js | 22 |
| pnpm | 10.34.4 |
| Git | 最新稳定版 |
Linux 系统依赖
Ubuntu/Debian 需要额外安装 GTK、WebKit 和打包工具:
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf1. 拉取源码
git clone --recurse-submodules https://github.com/ECLteam/EuoraCraft-Launcher.git
cd EuoraCraft-Launcher如果已经使用普通方式克隆,补充初始化子模块:
git submodule sync --recursive
git submodule update --init --recursive2. 安装后端依赖
Windows PowerShell
py -3.12 -m venv .venv
Set-ExecutionPolicy -Scope Process Bypass
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"Linux / macOS
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"3. 构建前端
cd frontend
pnpm install --frozen-lockfile
pnpm build
cd ..前端构建结果位于 frontend/dist,后端运行和 PyInstaller 打包都会读取该目录。
4. 运行源码
python main.pyMicrosoft 登录需要在根目录创建 .env 并填写 MICROSOFT_CLIENT_ID;未配置时仍可进行不依赖 Microsoft 登录的开发。运行日志位于 ECL_data/logs。
5. 检查项目
python -m ruff check ECL tests
python -m pytest -q修改过前端时,在 frontend 目录额外运行:
pnpm lint
pnpm typecheck
pnpm test
pnpm build6. 打包桌面程序
Windows PowerShell
$env:ECL_CONSOLE = "1"
$env:ECL_UPX = "0"
python -m PyInstaller --noconfirm EuoraCraft-Launcher.specLinux / macOS
ECL_CONSOLE=1 ECL_UPX=0 python -m PyInstaller --noconfirm EuoraCraft-Launcher.spec| 平台 | 构建结果 |
|---|---|
| Windows | dist/EuoraCraft Launcher.exe |
| Linux | dist/EuoraCraft Launcher |
| macOS | dist/EuoraCraft Launcher.app |
终端最后出现 Build complete!,并且 dist 中存在对应平台的制品,即表示构建完成。
常见问题
提示缺少 frontend/dist 时,请重新执行第 3 步;子模块目录为空时,请重新运行 git submodule update --init --recursive。
