
OpenClaw 是一款强大的 AI 助手框架,支持 Windows 平台部署。本文整合官方文档和社区最佳实践,提供多种安装方案。
📚 推荐学习路径
官方文档(最权威):
社区实战:
📋 系统要求
| 项目 | 最低要求 | 推荐配置 |
|---|---|---|
| 操作系统 | Windows 10 | Windows 11 |
| 内存 | 4GB | 8GB+ |
| 磁盘 | 10GB | 20GB+ SSD |
| Node.js | v18+ | v20+ |
| Python | 3.8+ | 3.10+ |
🚀 方案一:PowerShell 一键安装(推荐)
最简单快速的方法:
# 以管理员身份运行 PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# 一键安装脚本
irm https://docs.openclaw.ai/zh-CN/install | iex
# 验证安装
openclaw --version
优点:
- ✅ 全自动安装
- ✅ 自动配置环境变量
- ✅ 自动安装依赖
- ✅ 适合新手
🔧 方案二:手动安装(原生方案)
1. 安装 Node.js
下载安装 Node.js:
- 访问:https://nodejs.org/
- 下载 LTS 版本(推荐 v20)
- 运行安装程序,按提示操作
验证安装:
# 打开 PowerShell
node --version
npm --version
2. 安装 OpenClaw
# 全局安装
npm install -g openclaw
# 验证安装
openclaw --version
3. 初始化工作区
# 创建工作区
mkdir C:\openclaw-workspace
cd C:\openclaw-workspace
# 初始化配置
openclaw init
🐳 方案三:Docker 方案(高级用户)
1. 安装 Docker Desktop
- 访问:https://www.docker.com/products/docker-desktop/
- 下载并安装 Docker Desktop
- 启动 Docker Desktop
2. 拉取 OpenClaw 镜像
# 拉取镜像
docker pull openclaw/gateway:latest
# 查看镜像
docker images
3. 运行容器
# 创建数据卷
docker volume create openclaw-data
# 运行容器
docker run -d `
--name openclaw `
-p 18789:18789 `
-v openclaw-data:/root/.openclaw `
openclaw/gateway:latest
4. 验证运行
# 查看容器状态
docker ps
# 查看日志
docker logs -f openclaw
⚙️ 配置优化
1. 配置 API Keys
编辑配置文件:
notepad $env:USERPROFILE\.openclaw\workspace\TOOLS.md
必需配置:
## API Keys
### 阿里云百炼(推荐)
- Key: `sk-xxxxxxxxxxxxxxxx`
- 模型:qwen3.5-plus
### 火山引擎(备选)
- Key: `xxxxxxxxxxxxxxxx`
- 模型:doubao-seed-2.0-code
2. 配置代理(中国大陆用户)
编辑配置:
notepad $env:USERPROFILE\.openclaw\config.json
添加代理配置:
{
"proxy": {
"http": "http://127.0.0.1:7890",
"https": "http://127.0.0.1:7890"
}
}
3. 开机自启(Windows 服务)
创建批处理文件 C:\openclaw-start.bat:
@echo off
timeout /t 30 /nobreak
openclaw gateway start
添加到任务计划程序:
- 打开”任务计划程序”
- 创建基本任务
- 触发器:登录时
- 操作:启动程序(选择上面的 bat 文件)
🔍 常见问题解决
1. npm 安装失败
# 清理 npm 缓存
npm cache clean --force
# 使用淘宝镜像
npm config set registry https://registry.npmmirror.com
# 重新安装
npm install -g openclaw
2. 权限问题
# 以管理员身份运行 PowerShell
# 右键 PowerShell → 以管理员身份运行
# 或者修改 npm 全局目录
npm config set prefix "C:\npm-global"
# 添加环境变量
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\npm-global", "User")
3. 端口被占用
# 检查端口占用
netstat -ano | findstr :18789
# 杀死占用进程
taskkill /F /PID <PID>
# 或者修改端口
notepad $env:USERPROFILE\.openclaw\config.json
# 修改 "port": 18790
4. Docker 无法启动
# 检查 Docker 服务
Get-Service Docker
# 启动 Docker
Start-Service Docker
# 重启 Docker Desktop
# 关闭 Docker Desktop
# 重新打开
5. 网络连接问题
# 测试网络连接
Test-NetConnection api.binance.com -Port 443
# 配置代理后测试
$env:HTTP_PROXY="http://127.0.0.1:7890"
$env:HTTPS_PROXY="http://127.0.0.1:7890"
Test-NetConnection api.binance.com -Port 443
📊 性能优化
1. 使用 SSD 存储
确保工作区在 SSD 上:
# 查看工作区位置
openclaw status
# 如果不在 SSD,迁移工作区
Move-Item $env:USERPROFILE\.openclaw D:\openclaw
New-Item -ItemType SymbolicLink -Path $env:USERPROFILE\.openclaw -Target D:\openclaw
2. 增加 Node.js 内存
编辑启动配置:
$env:NODE_OPTIONS="--max-old-space-size=4096"
3. 定期清理
# 清理 npm 缓存
npm cache clean --force
# 清理 Docker(如使用 Docker 方案)
docker system prune -a
✅ 验证安装
# 1. 检查版本
openclaw --version
# 2. 检查网关状态
openclaw gateway status
# 3. 发送测试消息
openclaw message send "Hello OpenClaw!"
# 4. 查看日志
Get-Content $env:USERPROFILE\.openclaw\workspace\memory\*.log -Tail 50 -Wait
成功标志:
- ✅ 版本号正常显示
- ✅ 网关状态显示”Running”
- ✅ 能收到 AI 回复
- ✅ 日志无 ERROR 级别错误
原创文章,作者:中国IPv6网,如若转载,请注明出处:https://www.ipv6s.com/soft/202603124358.html
微信扫一扫
支付宝扫一扫