乐于分享
好东西不私藏

OpenClaw本地部署,windows环境,帮你踩了所有坑,有两方案保姆教程,保证你可以训练自己的小龙虾

OpenClaw本地部署,windows环境,帮你踩了所有坑,有两方案保姆教程,保证你可以训练自己的小龙虾
首先安装环境
1.安装Node.js、Git
  • Node.js 下载地址:https://nodejs.org/en/download
  • Git 下载地址:https://git-scm.com/install/windows
2.验证安装结果
# 这是一个 PowerShell 命令,用于修改 PowerShell 的脚本执行安全策略,专门解决 “无法运行脚本,因为在此系统上禁止运行脚本” 的报错。什么时候需要用这个命令?当你运行 PowerShell 脚本(比如之前 OpenClaw 安装过程中调用的 install.ps1)时,如果报错提示 “无法加载,因为在此系统上禁止运行脚本”,就需要先执行这个命令来放开限制。RemoteSigned 是一个兼顾安全和便利的推荐设置,既不会过度限制日常使用,也能防止未经验证的外网脚本随意运行。Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUsernode -v npm -v git -v
方案1
官网网址: https://docs.openclaw.ai/
iwr -useb https://openclaw.ai/install.ps1 | iex
01:可能遇到的问题一:提示缺少执行脚本的权限--可执行以下命令
PS C:\WINDOWS\system32> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser执行策略更改执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?[Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 暂停(S)  [?] 帮助 (默认值为“N”): A
02:npm安装失败:
# 手动使用npm安装试一下npm install -g openclaw
03:可以尝试使用pnpm尝试安装:
# 先试用npm安装 pnpmnpm i-g pnpm# 检查pnpm 是否安装成功  pnpm -v# 使用下面的命令可以自动的配置全局安装路径pnpm setup# 安装pnpm add -g openclaw@latest# 还需要看执行后的结果 如果提示 说忽略了一些包的构建脚本# 使用如下命令来批准 构建脚本pnpm approve-builds -g
需要执行:
# 这是一个 PowerShell 命令,用于修改 PowerShell 的脚本执行安全策略,专门解决 “无法运行脚本,因为在此系统上禁止运行脚本” 的报错。什么时候需要用这个命令?当你运行 PowerShell 脚本(比如之前 OpenClaw 安装过程中调用的 install.ps1)时,如果报错提示 “无法加载,因为在此系统上禁止运行脚本”,就需要先执行这个命令来放开限制。RemoteSigned 是一个兼顾安全和便利的推荐设置,既不会过度限制日常使用,也能防止未经验证的外网脚本随意运行。Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
4.开始初始化配置OpenClaw

openclaw onboard --install-daemon

选择模型就选择前文,会弹出一个网页来认证登录
然后就是配置聊天渠道先跳过,后面再配置
按需选择技能包 安装clawhub就可以随时安装社区里的技能包 快速扩展能力
再安装一下npm  是安装技能的工具我们就使用npm即可
apikey就全部选择NO然后接下来会自动安装并启动Openclaw和Gateway网关服务
然后就可以使用了:
方法二
1.下载 OpenClaw
npm install -g openclaw@latest
PS C:\WINDOWS\system32> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser执行策略更改执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?[Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 暂停(S)  [?] 帮助 (默认值为“N”): APS C:\WINDOWS\system32> npm install -g openclaw@latestnpm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.npm warn deprecated gauge@3.0.2: This package is no longer supported.npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supportednpm warn deprecated npmlog@5.0.1: This package is no longer supported.npm warn deprecated glob@7.2.3: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.menpm warn deprecated tar@6.2.1: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.menpm warn deprecated glob@10.5.0: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.meadded 656 packages in 12m127 packages are looking for funding  run `npm fund` for detailsnpm noticenpm notice New minor version of npm available! 11.9.0 -> 11.11.0npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.11.0npm notice To update run: npm install -g npm@11.11.0npm noticePS C:\WINDOWS\system32>
验证:
PS C:\WINDOWS\system32> openclaw -v2026.3.2PS C:\WINDOWS\system32>
4.初始化配置OpenClaw
openclaw onboard

详细如下:

PS C:\WINDOWS\system32> openclaw onboard🦞 OpenClaw 2026.3.2 (85377a2) — The lobster in your shell. 🦞Windows detected — OpenClaw runs great on WSL2!Native Windows might be trickier.Quick setup: wsl --install (one command, one reboot)Guide: https://docs.openclaw.ai/windows▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░████░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░████░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀                  🦞 OPENCLAW 🦞T  OpenClaw onboarding|o  Security ---------------------------------------------------------------------------------+|                                                                                            ||  Security warning — please read.                                                           ||                                                                                            ||  OpenClaw is a hobby project and still in beta. Expect sharp edges.                        ||  By default, OpenClaw is a personal agent: one trusted operator boundary.                  ||  This bot can read files and run actions if tools are enabled.                             ||  A bad prompt can trick it into doing unsafe things.                                       ||                                                                                            ||  OpenClaw is not a hostile multi-tenant boundary by default.                               ||  If multiple users can message one tool-enabled agent, they share that delegated tool      ||  authority.                                                                                ||                                                                                            ||  If you’re not comfortable with security hardening and access control, don’t run           ||  OpenClaw.                                                                                 ||  Ask someone experienced to help before enabling tools or exposing it to the internet.     ||                                                                                            ||  Recommended baseline:                                                                     ||  - Pairing/allowlists + mention gating.                                                    ||  - Multi-user/shared inbox: split trust boundaries (separate gateway/credentials, ideally  ||    separate OS users/hosts).                                                               ||  - Sandbox + least-privilege tools.                                                        ||  - Shared inboxes: isolate DM sessions (`session.dmScope: per-channel-peer`and keep      ||    tool access minimal.                                                                    ||  - Keep secrets out of the agent’s reachable filesystem.                                   ||  - Use the strongest available model for any bot with tools or untrusted inboxes.          ||                                                                                            ||  Run regularly:                                                                            ||  openclaw security audit --deep                                                            ||  openclaw security audit --fix                                                             ||                                                                                            ||  Must read: https://docs.openclaw.ai/gateway/security                                      ||                                                                                            |+--------------------------------------------------------------------------------------------+|*  I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?|    Yes / > No

5.进行交互式配置

第一个 选择就是告诉您权限很高有风险 部署存在风险时,选择“yes"并回车
左右键选择:yes
o  I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?|  Yes|*  Onboarding mode|  > QuickStart (Configure details later via openclaw configure.)|    Manual
详细如下:
向导步骤
必须选择的选项
操作说明
1. Risk 风险确认
yes
输入yes,按回车,继续配置
2. Onboarding mode 配置模式
QuickStart
官方推荐快速配置,无需高级模式
3. Model/auth provider 模型认证
Skip for now
官方建议先跳过,后续专门配置 LongCat
4. Filter models by provider 模型过滤
All providers
全选提供商,无遗漏
5. Default model 默认模型
Keep current
保持当前设置,后续统一修改
6. Select channel 消息渠道
Skip for now
官方建议先跳过,不影响核心使用
7. Configure skills 技能配置
Yes
官方推荐启用本地实用技能
8. 技能安装的包管理器
npm
官方推荐选项,兼容性最好
9. Install missing skill dependencies 依赖安装
Skip for now
先跳过,不影响核心流程
10. 第三方 API Key 设置
全部选 No/Skip
非必要配置,全部跳过,直到下一步
11. Gateway service 网关服务
Install/Reinstall
【最关键一步!】必须选安装 / 重装,之前的断开问题就是这里没装
12. How to hatch your bot 启动方式
Hatch in TUI
官方推荐交互式终端界面,方便后续调试
Gateway 服务状态校验(彻底解决之前的 disconnected 问题)
步骤 1:检查网关运行状态
在 PowerShell 中执行下方命令:
openclaw status
大公告成
最后求个点赞转发,毕竟好东西,就得程序员之间互相种草!👇
我还准备了好多有用的资源,可以通过如下方法免费下载:
快去看看吧:
好文推荐
彻底卸载OpenClaw-别以为没用先收藏,按照我的方法来保证卸载的连虾皮都不剩