Windows (WSL2) 安装
为什么选择 WSL2?
Section titled “为什么选择 WSL2?”WSL2 提供了完整的 Linux 环境,是 Windows 上运行 Hermes Agent 的最佳方式。相比原生 Windows,WSL2 具有以下优势:
- 完整的 Linux 工具链支持
- 更好的文件系统性能
- 原生 Docker 兼容
- 社区文档和示例均基于 Linux 环境
| 需求 | 最低配置 | 推荐配置 |
|---|---|---|
| Windows | Windows 10 2004+ | Windows 11 |
| WSL | WSL 2 | WSL 2 |
| 内存 | 4GB(含 WSL 开销) | 8GB+ |
| 磁盘 | 10GB(含 WSL 发行版) | 20GB+ |
第 1 步:安装 WSL2
Section titled “第 1 步:安装 WSL2”一键安装(Windows 11 / Windows 10 2022+)
Section titled “一键安装(Windows 11 / Windows 10 2022+)”以管理员身份打开 PowerShell:
wsl --install重启计算机后,WSL2 将自动安装 Ubuntu 作为默认发行版。
如果一键安装不可用,手动执行以下步骤:
# 启用 WSL 功能dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# 启用虚拟机平台dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# 重启计算机重启后,设置 WSL 2 为默认版本:
wsl --set-default-version 2安装 Ubuntu 发行版:
wsl --install -d Ubuntu第 2 步:在 WSL2 中安装 Hermes Agent
Section titled “第 2 步:在 WSL2 中安装 Hermes Agent”进入 WSL2 终端:
# 打开 WSLwslcurl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bashcurl -fsSL https://res1.hermesagent.org.cn/install.sh | bash重新加载 Shell
Section titled “重新加载 Shell”source ~/.bashrchermes --versionhermes doctorPowerShell 安装脚本(替代方案)
Section titled “PowerShell 安装脚本(替代方案)”如果你想在 PowerShell 中直接完成安装(自动配置 WSL2 + Hermes Agent):
# 下载并运行 PowerShell 安装脚本Invoke-RestMethod -Uri "https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install-windows.ps1" | Invoke-Expression:::caution PowerShell 脚本说明 此脚本会自动检查 WSL2 状态,如未安装会引导安装。需要以管理员身份运行 PowerShell。 :::
原生 Windows 早期测试版
Section titled “原生 Windows 早期测试版”Hermes Agent 正在开发原生 Windows 支持。目前处于 早期测试阶段,不建议用于生产环境。
# 使用 pip 安装(需要 Python 3.10+)pip install hermes-agent- 部分工具依赖 Linux 命令,在原生 Windows 下不可用
- Shell 命令默认使用 PowerShell 语法
- 文件路径使用 Windows 格式(反斜杠)
- 浏览器自动化功能可能有兼容性问题
:::caution 早期测试版 原生 Windows 版本功能尚不完整,推荐优先使用 WSL2 方式。如果你遇到问题,请在 GitHub Issues 中反馈。 :::
WSL2 配置优化
Section titled “WSL2 配置优化”在 Windows 用户目录下创建 .wslconfig 文件(C:\Users\<你的用户名>\.wslconfig):
[wsl2]memory=4GBprocessors=2swap=2GB修改后重启 WSL:
wsl --shutdownwsl文件系统性能
Section titled “文件系统性能”# 将项目放在 Linux 文件系统内(性能更优)cd ~/git clone https://github.com/NousResearch/hermes-agent.git
# 避免在 /mnt/c/ 下操作(跨文件系统性能较差):::tip 性能提示
WSL2 中访问 Linux 文件系统内的文件比访问 /mnt/c/ 快数倍。建议将 Hermes Agent 安装在 Linux 文件系统内。
:::
Windows Terminal 集成
Section titled “Windows Terminal 集成”推荐使用 Windows Terminal,它对 WSL2 提供了良好的原生支持,包括标签页、分屏等功能。
WSL2 安装失败
Section titled “WSL2 安装失败”# 检查 Windows 版本winver
# 确保 Windows 版本 >= 10.0.19041# 更新 Windows 到最新版本WSL2 无法联网
Section titled “WSL2 无法联网”# 重置网络wsl --shutdownnetsh winsock resetnetsh int ip reset# 重启计算机Hermes 命令找不到
Section titled “Hermes 命令找不到”# 在 WSL 中重新加载 Shellsource ~/.bashrc
# 或手动添加 PATHecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc