OpenClaw 企业定制 私人订制工作流 优化运维 openclaw记忆优化 问题咨询解决 请加微信交流
微信: aixbwz
想用Hermes Agent但不知道从哪开始?安装其实很简单,60秒就能跑起来。官方提供多种安装方式,自动脚本、pip、源码、Docker,总有一款适合你。这篇讲清楚所有安装方式、最小配置、以及常见坑怎么避免。
安装要求
在开始之前,确认你的环境满足要求:
| 要求 | 最低 | 推荐 |
|---|---|---|
| 操作系统 | Linux/macOS/WSL2 | Ubuntu 22.04 / macOS Sonoma |
| Python | 3.10+ | 3.11+ |
| 内存 | 4GB | 8GB+ |
| 磁盘 | 2GB可用 | 10GB+ |
| 网络 | 能访问API | 稳定宽带 |
Windows用户建议用WSL2,macOS直接装原生,Linux最推荐。树莓派等ARM设备也支持。
方式一:自动安装脚本(推荐新手)
一行命令搞定,自动检测环境、安装依赖、配置初始化:
curl -s https://hermes-agent.nousresearch.com/install.sh | sh
或者用wget:
wget -qO- https://hermes-agent.nousresearch.com/install.sh | sh
自动脚本会做以下事情:
- 检查Python版本是否满足要求(3.10+)
- 安装系统依赖(如果需要)
- 创建Hermes配置目录~/.hermes/
- 安装hermes-agent及所有Python依赖
- 生成初始配置文件
- 验证安装是否成功
安装完成后会显示:
✅ Hermes Agent 安装成功!
运行 'hermes chat' 开始对话
方式二:pip安装(标准Python方式)
如果你熟悉Python生态,用pip安装:
pip install hermes-agent
或指定版本:
pip install hermes-agent==1.4.2
用uv更快(推荐):
# 安装uv(如果还没有)
curl -LsSf https://astral.sh/uv/install.sh | sh
# 用uv安装
uv pip install hermes-agent
方式三:从源码安装(适合开发者)
想看源码、贡献代码、或者需要最新功能:
git clone https://github.com/NousResearch/hermes-agent.git
cd hermes-agent
# 用uv安装可编辑模式
uv pip install -e .
# 或者用pip
pip install -e .
可编辑模式的好处是修改源码后立即生效,不需要重新安装。
方式四:Docker安装(零依赖)
不想装Python环境?Docker打包了一切:
# 拉取最新镜像
docker pull nousresearch/hermes-agent:latest
# 交互式运行
docker run -it --rm -v ~/.hermes:/home/hermes/.hermes -v ~/.ssh:/home/hermes/.ssh:ro -e OPENROUTER_API_KEY=sk-or-xxx nousresearch/hermes-agent:latest
# 或者用docker-compose
# 创建docker-compose.yml并运行
docker compose up
Docker方式不需要本地Python环境,但需要注意卷挂载和API Key的配置。
方式五:Homebrew(macOS专属)
brew tap NousResearch/tap
brew install hermes-agent
验证安装
# 检查版本
hermes --version
# 输出: hermes-agent 1.4.2
# 运行环境诊断
hermes doctor
# 检查Python、依赖、配置等
hermes doctor会检查:
- Python版本是否满足要求
- 所有Python依赖是否安装
- 配置文件是否正确
- 网络连接是否正常
配置API Key
Hermes需要连接AI模型才能工作。最简单的方式是用OpenRouter,支持Claude、GPT、Gemini等多种模型:
第一步:获取OpenRouter API Key
- 访问 https://openrouter.ai
- 注册账号(可用Google登录)
- 进入Dashboard,点击API Keys
- 创建新Key,格式:sk-or-v1-xxx
第二步:配置Key
# 命令行方式
hermes config set OPENROUTER_API_KEY sk-or-v1-xxx
# 或编辑配置文件
vi ~/.hermes/config.yaml
providers:
openrouter:
api_key: "sk-or-v1-xxx"
default: true
models:
default: "anthropic/claude-sonnet-4-6"
fast: "google/gemini-flash-2.0"
配置国内模型(可选)
如果想用国内模型:
# DeepSeek
providers:
deepseek:
api_key: "sk-xxx"
base_url: "https://api.deepseek.com/v1"
# MiniMax
providers:
minimax:
api_key: "eyJxxx"
base_url: "https://api.minimax.chat/v1"
# 硅基流动(便宜量大)
providers:
siliconflow:
api_key: "sk-xxx"
base_url: "https://api.siliconflow.cn/v1"
第一次对话
配置好API Key后,开始第一次对话:
hermes chat
看到对话提示符后,直接问问题:
hermes> 你好,帮我写一个Python函数判断质数
AI会回答。如果没反应,检查:
- API Key是否配置正确
- Key是否有额度
- 网络是否能访问
退出对话:输入/exit或按Ctrl+C。
WSL2特别说明(Windows用户)
Windows上推荐用WSL2,性能接近原生Linux:
# 安装WSL2
wsl --install -d Ubuntu-22.04
# 进入Ubuntu
wsl
# 更新系统
sudo apt update && sudo apt upgrade -y
# 安装前置依赖
sudo apt install curl git python3-venv -y
# 然后按Linux方式安装
curl -s https://hermes-agent.nousresearch.com/install.sh | sh
WSL2使用注意:
- 配置文件在~/.hermes/(WSL2的Linux家目录)
- Windows磁盘挂载在/mnt/c/等位置
- 网络跟Windows共享,不需要额外配置
配置国内镜像源(加速pip)
国内pip安装慢,换镜像:
# 临时使用
pip install hermes-agent -i https://pypi.tuna.tsinghua.edu.cn/simple
# 永久设置
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
常用镜像:
- 清华:https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里:https://mirrors.aliyun.com/pypi/simple
- 腾讯:https://mirrors.cloud.tencent.com/pypi/simple
常见安装问题及解决
Python版本不对
# 检查Python版本
python3 --version
# 要求 >= 3.10
Ubuntu安装新版Python:
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install python3.11 python3.11-venv python3.11-dev -y
权限问题
# 错误:Could not install packages due to file permission
# 绝对不要用sudo,会污染系统环境!
# 正确做法:用用户目录或虚拟环境
pip install hermes-agent --user
# 或用uv安装(推荐,自动处理权限)
uv pip install hermes-agent
找不到hermes命令
# 检查安装位置
which hermes
# 如果用虚拟环境,确保已激活
source ~/.hermes/venv/bin/activate
# 或添加pip用户bin到PATH
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
网络超时/失败
# 设置代理
export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890
# 或用国内镜像
pip install hermes-agent -i https://pypi.tuna.tsinghua.edu.cn/simple
OpenSSL错误
# Ubuntu
sudo apt install libssl-dev pkg-config -y
# macOS
brew install openssl
brew link openssl --force
macOS xcode-select问题
# 安装Command Line Tools
xcode-select --install
# 或用Homebrew安装
brew install python@3.11
卸载
# pip卸载
pip uninstall hermes-agent
# 删除配置(可选,清除所有记忆和设置)
rm -rf ~/.hermes
# 删除虚拟环境
rm -rf ~/.hermes/venv
升级
# pip升级到最新版
pip install --upgrade hermes-agent
# Docker升级
docker pull nousresearch/hermes-agent:latest
# 源码安装的升级
cd ~/hermes-agent && git pull && uv pip install -e .
多版本管理
需要同时跑多个版本时,用虚拟环境隔离:
# 创建1.4版本环境
python3 -m venv ~/hermes-env-1.4
source ~/hermes-env-1.4/bin/activate
pip install hermes-agent==1.4.0
# 创建1.5版本环境
python3 -m venv ~/hermes-env-1.5
source ~/hermes-env-1.5/bin/activate
pip install hermes-agent==1.5.0
总结
安装三步走:
- 运行安装脚本:curl -s https://hermes-agent.nousresearch.com/install.sh | sh
- 配置API Key:hermes config set OPENROUTER_API_KEY sk-or-xxx
- 开始对话:hermes chat
60秒装好,5分钟配置好,马上能用。遇到问题先用hermes doctor诊断。
相关文章
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END







暂无评论内容