项目背景
OpenClaw 是一个开源 AI 助手框架,支持多种大语言模型和消息平台集成。树莓派 4B(4GB 内存)因其低功耗、7x24 小时运行能力和硬件集成特性,成为了理想的部署平台。
一、环境准备:树莓派的特殊挑战
1.1 系统环境确认
- 硬件:树莓派 4B(ARM Cortex-A72,4 核,3.5GB 内存)
- 系统:Raspberry Pi OS(基于 Debian 的 ARM64 架构)
- Python 版本:3.8+(需手动升级)
- Node.js 版本:v22.22.0(符合 OpenClaw 要求)
1.2 Python 版本升级
树莓派默认安装的 Python 版本可能较低,而 OpenClaw 需要 Python 3.8+。遇到 Unable to locate package python3.8 错误时,需从源代码编译安装:
sudo apt-get install -y build-essential tk-dev libncurses5-dev wget
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar zxf Python-3.8.0.tgz
cd Python-3.8.0
./configure --enable-optimizations
make -j4
sudo make altinstall
二、网络限制:学校环境下的最大障碍
2.1 GitHub 访问限制
学校网络对 GitHub 的访问设置了多重限制,安装过程中频繁出现 ERR_EMPTY_RESPONSE 和 ERR_SSL_WRONG_VERSION_NUMBER 错误。
解决方案:
使用国内镜像源:
npm config set registry https://registry.npmmirror.com
优化 Git 超时设置:
git config --global http.postBuffer 524288000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
配置 Git 使用 HTTPS 代替 SSH:
git config --global url."https://github.com/".insteadOf ssh://[email protected]/
git config --global url."https://".insteadOf ssh://
2.2 npm 安装失败问题
在安装 OpenClaw 时,npm install 阶段频繁失败,特别是下载 libsignal-node 等依赖包时。关键发现是 [email protected] 已被标记为弃用。
解决方案:
使用 cnpm 替代 npm:
npm install -g cnpm --registry=https://registry.npmmirror.com
cnpm install -g openclaw@latest
从 GitHub 源码手动安装 libsignal-node:
git clone https://github.com/whiskeysockets/libsignal-node.git
libsignal-node
npm install
npm

