CostPrediction/docs/windows_setup.md

74 lines
1.2 KiB
Markdown
Raw Permalink 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.

# Windows 开发环境设置
1. 安装必要软件
- Python 3.11.8: <https://www.python.org/downloads/>
- Git: <https://git-scm.com/download/win>
- MySQL 8.0+: <https://dev.mysql.com/downloads/mysql/>
- Visual Studio Build Tools: <https://visualstudio.microsoft.com/visual-cpp-build-tools/>
- Node.js 18+ LTS: <https://nodejs.org/download/>安装时Chocolatey不是必需的
- npm 9+: (随 Node.js 一起安装)
2. 克隆项目
```powershell
git clone [repository-url]
cd cost-prediction
```
3. 设置前端环境
```powershell
# 进入前端目录
cd frontend
# 安装依赖
npm install 22
nvm use 22
# 构建生产版本
npm run build
# 返回项目根目录
cd ..
```
4. 设置 Python 环境
```powershell
# 创建虚拟环境
python -m venv .venv
# 激活虚拟环境
.\.venv\Scripts\Activate.ps1
# 安装依赖
pip install -e .
```
5. 配置数据库
```powershell
# 确保 MySQL 服务已启动
# 初始化数据库和导入数据
```
6. 运行测试
```powershell
python src/test_api.py
```
7. 打包项目
```powershell
# 先下载所有依赖
.\scripts\download_deps.ps1
# 然后运行打包脚本
.\scripts\build_win.ps1
```
## 注意:如果需要制作发布包,请参考 docs/release_guide.md