Update project setup scripts and enhance README for clarity
- Modified the backend setup script to clear the virtual environment before installation. - Improved README.md by restructuring the prerequisites section into a table for better readability. - Added installation instructions for the `uv` package and clarified terminal requirements post-installation.
This commit is contained in:
parent
e432e223df
commit
08688a892d
3 changed files with 21 additions and 8 deletions
23
README.md
23
README.md
|
|
@ -29,19 +29,29 @@ MiroFish/
|
||||||
|
|
||||||
### 前置要求
|
### 前置要求
|
||||||
|
|
||||||
- **Python 3.11+**
|
在开始之前,请确保已安装以下工具:
|
||||||
- **Node.js 18+**
|
|
||||||
- **[uv](https://docs.astral.sh/uv/)**(Python 包管理器)
|
| 工具 | 版本要求 | 说明 | 安装检查 |
|
||||||
|
|------|---------|------|---------|
|
||||||
|
| **Node.js** | 18+ | 前端运行环境,包含 npm | `node -v` |
|
||||||
|
| **Python** | 3.11+ | 后端运行环境 | `python --version` |
|
||||||
|
| **uv** | 最新版 | Python 包管理器(替代 pip) | `uv --version` |
|
||||||
|
|
||||||
|
#### 安装 uv
|
||||||
|
|
||||||
安装 uv:
|
|
||||||
```bash
|
```bash
|
||||||
# macOS/Linux
|
# macOS/Linux
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
|
||||||
# Windows
|
# Windows (PowerShell)
|
||||||
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
||||||
|
|
||||||
|
# 或使用 Homebrew (macOS)
|
||||||
|
brew install uv
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ⚠️ 安装 uv 后需要**重新打开终端**或执行 `source ~/.zshrc` (macOS/Linux) 使其生效。
|
||||||
|
|
||||||
### 配置环境变量
|
### 配置环境变量
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -186,6 +196,9 @@ A: 检查后端是否正常运行在 5001 端口,前端开发服务器会自
|
||||||
### Q: OASIS 模拟启动失败
|
### Q: OASIS 模拟启动失败
|
||||||
A: 确保已安装 `camel-oasis` 和 `camel-ai` 依赖,且 LLM API 配置正确。
|
A: 确保已安装 `camel-oasis` 和 `camel-ai` 依赖,且 LLM API 配置正确。
|
||||||
|
|
||||||
|
### Q: 运行 `npm run setup:backend` 报错 "uv: command not found"
|
||||||
|
A: uv 未安装或未加入 PATH。请先安装 uv(参考前置要求),安装后**重新打开终端**再执行。
|
||||||
|
|
||||||
### Q: Windows 上 Python 虚拟环境激活失败
|
### Q: Windows 上 Python 虚拟环境激活失败
|
||||||
A: 使用 `.venv\Scripts\activate` 而不是 `source .venv/bin/activate`。
|
A: 使用 `.venv\Scripts\activate` 而不是 `source .venv/bin/activate`。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ dev = [
|
||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[tool.uv]
|
[dependency-groups]
|
||||||
dev-dependencies = [
|
dev = [
|
||||||
"pytest>=8.0.0",
|
"pytest>=8.0.0",
|
||||||
"pytest-asyncio>=0.23.0",
|
"pytest-asyncio>=0.23.0",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "MiroFish - 简洁通用的群体智能引擎,预测万物",
|
"description": "MiroFish - 简洁通用的群体智能引擎,预测万物",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm install && cd frontend && npm install",
|
"setup": "npm install && cd frontend && npm install",
|
||||||
"setup:backend": "cd backend && uv venv && uv pip install -r requirements.txt",
|
"setup:backend": "cd backend && uv venv --clear && uv pip install -r requirements.txt",
|
||||||
"setup:all": "npm run setup && npm run setup:backend",
|
"setup:all": "npm run setup && npm run setup:backend",
|
||||||
"dev": "concurrently -n \"backend,frontend\" -c \"yellow,cyan\" \"npm run backend\" \"npm run frontend\"",
|
"dev": "concurrently -n \"backend,frontend\" -c \"yellow,cyan\" \"npm run backend\" \"npm run frontend\"",
|
||||||
"backend": "cd backend && uv run python run.py",
|
"backend": "cd backend && uv run python run.py",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue