OpenClaw Windows 安装教程

iwr -useb https://openclaw.ai/install.ps1 | iex
本文介绍如何在 Windows 系统安装 OpenClaw 并启动 Web 控制台。
OpenClaw 是一个开源 AI Agent 框架,可以自动操作电脑、浏览器和执行任务,例如:
- 自动写代码
- 自动抓取网页数据
- 自动生成文件
- 自动操作浏览器
一、系统要求
建议环境:
| 软件 | 版本 |
|---|---|
| Windows | Windows 10 / 11 |
| Node.js | >= 22 |
| PowerShell | >= 5 |
| 内存 | 8GB+ 推荐 |
二、安装 Node.js
如果没有 Node.js,需要先安装。
下载地址:
安装完成后验证:
node -v
如果输出类似:
v22.3.0
说明安装成功。
三、安装 OpenClaw
打开 PowerShell(管理员模式)
执行:
iwr -useb https://openclaw.ai/install.ps1 | iex
该脚本会自动:
- 下载 OpenClaw
- 安装依赖
- 配置环境变量
安装完成后关闭 PowerShell。
四、初始化 OpenClaw
重新打开 PowerShell。
执行:
openclaw onboard
该命令会:
- 初始化配置
- 创建用户数据目录
- 启动后台服务
完成后系统会生成一个设备 ID。
五、启动 Web 控制台
运行:
openclaw dashboard
浏览器访问:
http://127.0.0.1:18789
如果看到控制台界面,说明安装成功。
六、配置 AI 模型
首次使用需要配置 AI API。
常见支持:
| 模型 | 推荐 |
|---|---|
| OpenAI | GPT |
| Claude | Claude 3 |
| DeepSeek | 国内推荐 |
| OpenRouter | 多模型支持 |
在控制台中填写 API Key 即可。
七、测试任务
在控制台输入一个简单任务,例如:
搜索 AI Agent 最新新闻并生成总结
OpenClaw 会自动:
- 打开浏览器
- 搜索内容
- 抓取网页
- 生成总结
八、常见问题
1 Node 版本过低
检查:
node -v
必须 >= 22。
2 端口无法访问
默认端口:
18789
检查是否被防火墙拦截。
3 PowerShell 权限不足
安装时建议:
右键 PowerShell → 以管理员身份运行
九、卸载 OpenClaw
如果需要卸载:
npm uninstall -g openclaw
同时删除配置目录:
C:\Users\用户名\.openclaw
十、开发者模式
如果你是开发者,可以使用开发模式:
npm install -g openclaw
openclaw onboard
openclaw dashboard
十一 QQ机器人

QQ开放平台|机器人列表
更多参考🔥玩转OpenClaw|云上OpenClaw(Clawdbot)快速接入QQ指南-腾讯云开发者社区-腾讯云
能干啥
OpenClaw 构建自动化 AI Agent,例如:
- 自动数据采集
- 自动写代码
- 自动运营任务
- 自动网页操作
安装失败的路线
OpenClaw 在 Windows 上的完整安装教程
系统环境
- 操作系统: Windows 11 Pro 10.0.26100
- Node.js版本: v22.19.0
- Shell: Git Bash (Unix风格)
- 安装日期: 2026-03-07
安装前准备
1. 检查系统环境
# 检查Node.js版本(需要v22或更高)
node --version
# 输出: v22.19.0 ✅
# 检查WSL2(可选,推荐但非必需)
wsl --version
# 如果未安装会提示: WSL not found
# 检查Docker(可选)
docker --version
# 如果未安装会提示: Docker not found
安装过程
方法一:标准安装(推荐但需要C++工具)
问题1: 缺少Visual Studio C++构建工具
尝试的命令:
npm install -g openclaw@latest
遇到的错误:
npm error You need to install the latest version of Visual Studio
npm error including the "Desktop development with C++" workload.
npm error ERROR OMG Could not find any Visual Studio installation to use
原因分析:
- OpenClaw依赖
node-llama-cpp模块 - 该模块需要编译C++代码
- Windows上需要Visual Studio构建工具
解决方案A: 安装Visual Studio构建工具(完整功能)
-
访问下载页面:
https://visualstudio.microsoft.com/zh-hans/downloads/ 下载 "Visual Studio 2022 生成工具" (Build Tools)
-
运行安装程序,选择工作负载:
- ✅ 勾选 "使用C++的桌面开发"
- 这会安装约6-8GB的工具
安装完成后重启电脑
-
重新安装OpenClaw:
npm install -g openclaw@latest --force
解决方案B: 跳过编译(快速安装,推荐)
如果你只使用云端API(Claude、GPT等),不需要本地LLM,可以跳过C++编译:
npm install -g openclaw@latest --ignore-scripts
结果:
- ✅ 安装成功
- ✅ 核心功能正常
- ✅ 云端API支持
- ❌ 本地LLM支持缺失
方法二:使用WSL2(最佳体验)
OpenClaw官方推荐在WSL2中运行,体验更好:
# 安装WSL2
wsl --install
# 重启电脑后,在WSL2中安装
curl -fsSL https://openclaw.ai/install.sh | bash
初始配置
1. 验证安装
# 检查版本
openclaw --version
# 输出: 2026.3.2
2. 运行基本设置
# 创建配置文件和工作目录
openclaw setup
输出:
Wrote ~\.openclaw\openclaw.json
Workspace OK: ~\.openclaw\workspace
Sessions OK: ~\.openclaw\agents\main\sessions
3. 配置网关模式
# 设置为本地模式
openclaw config set gateway.mode local
4. 运行健康检查
# 自动修复配置问题
openclaw doctor --fix
启动OpenClaw
启动网关服务
# 直接启动(前台运行)
openclaw gateway
# 或者后台运行
openclaw gateway &
注意: 首次启动时会自动生成认证令牌
验证运行状态
openclaw status
正常输出应包含:
- ✅ Gateway: reachable
- ✅ Dashboard: http://127.0.0.1:18789/
- ✅ Auth: token
访问控制面板
问题2: 未授权错误
错误信息:
unauthorized: gateway token missing
原因:
- 网关启用了令牌认证
- 需要在URL中包含令牌
解决方案:
# 自动打开带令牌的控制面板
openclaw dashboard
这会:
- 自动读取配置文件中的令牌
- 生成带令牌的URL
- 在浏览器中打开
- 令牌复制到剪贴板
手动访问:
令牌存储在配置文件中:
# 查看配置文件
cat ~/.openclaw/openclaw.json
找到 gateway.auth.token 字段,然后访问:
http://127.0.0.1:18789/#token=你的令牌
配置文件位置
C:\Users\Administrator\.openclaw\
├── openclaw.json # 主配置文件
├── workspace/ # 工作目录
└── agents/
└── main/
└── sessions/ # 会话存储
配置文件示例:
{
"meta": {
"lastTouchedVersion": "2026.3.2",
"lastTouchedAt": "2026-03-07T13:49:26.157Z"
},
"agents": {
"defaults": {
"workspace": "C:\\Users\\Administrator\\.openclaw\\workspace"
}
},
"gateway": {
"mode": "local",
"auth": {
"mode": "token",
"token": "自动生成的令牌"
}
}
}
常见问题排查
问题3: 权限错误(EPERM)
错误信息:
npm warn cleanup Failed to remove some directories
Error: EPERM: operation not permitted
原因:
- Windows文件系统权限问题
- 某些文件被占用
解决方案:
- 以管理员身份运行终端
- 关闭可能占用文件的程序(杀毒软件、文件管理器)
- 使用
--ignore-scripts跳过编译
问题4: 网关无法启动
检查步骤:
# 1. 检查端口是否被占用
netstat -ano | findstr :18789
# 2. 查看详细日志
openclaw gateway --log-level debug
# 3. 强制启动(杀死占用端口的进程)
openclaw gateway --force
问题5: 内存搜索警告
警告信息:
Memory search is enabled but no embedding provider is configured
解决方案(可选):
# 方案1: 禁用内存搜索
openclaw config set agents.defaults.memorySearch.enabled false
# 方案2: 配置嵌入提供商
openclaw configure --section model
# 然后添加 OPENAI_API_KEY 或其他API密钥
下一步配置
1. 配置AI模型
# 查看可用模型
openclaw models list
# 配置模型认证
openclaw configure --section model
2. 连接消息平台
# 查看可用通道
openclaw channels --help
# 登录Telegram
openclaw channels login telegram
# 登录Discord
openclaw channels login discord
3. 查看可用技能
openclaw skills
4. 测试代理
openclaw agent --message "你好,OpenClaw!"
性能优化建议
- 使用WSL2: 获得更好的兼容性和性能
-
安装为服务: 开机自动启动
openclaw gateway install - 配置反向代理: 如果需要远程访问
-
启用沙箱: 提高安全性
openclaw sandbox enable
安全建议
- 保护令牌: 不要分享你的认证令牌
-
配置访问控制:
openclaw security audit --deep openclaw security audit --fix - 使用配对机制: 限制可以访问的设备
-
定期更新:
openclaw update
卸载
如果需要完全卸载:
# 卸载网关服务和数据
openclaw uninstall
# 卸载CLI工具
npm uninstall -g openclaw
# 手动删除配置目录
rm -rf ~/.openclaw
总结
成功安装的配置
- ✅ OpenClaw v2026.3.2
- ✅ Node.js v22.19.0
- ✅ 网关运行在 ws://127.0.0.1:18789
- ✅ 控制面板可访问
- ✅ 令牌认证已配置
- ✅ 默认模型: Claude Opus 4-6
- ⚠️ 本地LLM支持未安装(需要C++工具)
关键命令速查
# 启动网关
openclaw gateway
# 打开控制面板
openclaw dashboard
# 查看状态
openclaw status
# 健康检查
openclaw doctor
# 查看日志
openclaw logs --follow
# 查看帮助
openclaw --help
参考资源
- 官方文档: https://docs.openclaw.ai/
- GitHub仓库: https://github.com/openclaw/openclaw
- Windows安装指南: https://docs.openclaw.ai/windows
- 故障排除: https://docs.openclaw.ai/troubleshooting
文档生成时间: 2026-03-07
OpenClaw版本: 2026.3.2
系统: Windows 11 Pro 10.0.26100
配置、切换模型
之前是opendash改为
···openclaw onboard --install-daemon···




我是自定义站。
qq我已经配置了

配置技能
空格选择, enter提交


网页打不开网关失败
解决方案:
openclaw gateway --force
然后执行
openclaw dashboard
openclaw config validate 2>&1可验证 配置文件
要操作电脑需要把一些权限开启。

要配置自定义claude ai
则需要如下改base url

实际上可以你在这里体现。


验证测试

技能安装
C:\Users\Administrator>npm i -g clawhub
C:\Users\Administrator>clawhub login --token clh_Z4zJ-OzmaHQUdzxo
C:\Users\Administrator>clawhub --help
Usage: clawhub [options] [command]
ClawHub CLI v0.7.0
install, update, search, and publish agent skills.
Options:
-V, --cli-version Show CLI version
--workdir <dir> Working directory (default: cwd)
--dir <dir> Skills directory (relative to workdir, default: skills)
--site <url> Site base URL (for browser login)
--registry <url> Registry API base URL
--no-input Disable prompts
-h, --help display help for command
Commands:
login [options] Log in (opens browser or stores token)
logout Remove stored token
whoami Validate token
auth Authentication commands
search [options] <query...> Vector search skills
install [options] <slug> Install into <dir>/<slug>
update [options] [slug] Update installed skills
uninstall [options] <slug> Uninstall a skill
list List installed skills (from lockfile)
explore [options] Browse latest updated skills from the registry
inspect [options] <slug> Fetch skill metadata and files without installing
publish [options] <path> Publish skill from folder
delete [options] <slug> Soft-delete a skill (moderator/admin only)
hide [options] <slug> Hide a skill (moderator/admin only)
undelete [options] <slug> Restore a hidden skill (moderator/admin only)
unhide [options] <slug> Unhide a skill (moderator/admin only)
ban-user [options] <handleOrId> Ban a user and delete owned skills (moderator/admin only)
set-role [options] <handleOrId> <role> Change a user role (admin only)
star [options] <slug> Add a skill to your highlights
unstar [options] <slug> Remove a skill from your highlights
sync [options] Scan local skills and publish new/updated ones
Env:
CLAWHUB_SITE
CLAWHUB_REGISTRY
CLAWHUB_WORKDIR
(CLAWDHUB_* supported)
C:\Users\Administrator>clawhub install find-skills
✔ OK. Installed find-skills -> C:\Users\Administrator\UsersAdministrator.openclawworkspace\skills\find-skills
C:\Users\Administrator>clawhub install tavily-search
✔ OK. Installed tavily-search -> C:\Users\Administrator\UsersAdministrator.openclawworkspace\skills\tavily-search
C:\Users\Administrator>clawhub install github
✔ OK. Installed github -> C:\Users\Administrator\UsersAdministrator.openclawworkspace\skills\github
C:\Users\Administrator>clawhub install nano-pdf
✔ OK. Installed nano-pdf -> C:\Users\Administrator\UsersAdministrator.openclawworkspace\skills\nano-pdf
C:\Users\Administrator>clawhub install answeroverflow
✔ OK. Installed answeroverflow -> C:\Users\Administrator\UsersAdministrator.openclawworkspace\skills\answeroverflow
C:\Users\Administrator>clawhub install api-gateway
⠴ Downloading api-gateway@1.0.61
放开的权限配置 拿去
"tools": {
"profile": "full",
"allow": [
"read",
"write",
"edit",
"exec",
"process",
"web_search",
"web_fetch",
"browser",
"image",
"memory_search",
"memory_get",
"sessions_list",
"sessions_history"
]
},
"web": {
"enabled": true
},