系统镜像源配置(加速下载)
Ubuntu/Debian
# 使用阿里云镜像(以Ubuntu 22.04为例) sudo sed -i 's|http://archive.ubuntu.com|https://mirrors.aliyun.com|g' /etc/apt/sources.list sudo sed -i 's|http://security.ubuntu.com|https://mirrors.aliyun.com|g' /etc/apt/sources.list # 更新 sudo apt update
CentOS/RHEL/Rocky Linux
# 备份 sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak # 使用阿里云镜像(CentOS 7示例) sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo # 清理缓存 sudo yum clean all sudo yum makecache
Docker镜像加速
# 编辑Docker配置
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn",
"https://hub-mirror.c.163.com"
]
}
EOF
# 重启Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
Python PyPI镜像源配置
临时使用
pip install openclaw -i https://pypi.tuna.tsinghua.edu.cn/simple
永久配置
# 创建pip配置文件 mkdir -p ~/.pip cat > ~/.pip/pip.conf << EOF [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn EOF
常用镜像源
阿里云:https://mirrors.aliyun.com/pypi/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
中科大:https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣:https://pypi.douban.com/simple/
OpenClaw安装步骤
通过pip安装
# 安装最新版 pip install openclaw -i https://pypi.tuna.tsinghua.edu.cn/simple # 或安装指定版本 pip install openclaw==1.2.0 # 升级版本 pip install --upgrade openclaw
通过Git源码安装
# 克隆仓库 git clone https://github.com/opendilab/OpenClaw.git cd OpenClaw # 安装依赖 pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple # 安装包 pip install -e .
开发环境配置
Conda环境配置
# 添加清华镜像源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge conda config --set show_channel_urls yes # 创建环境 conda create -n openclaw python=3.8 conda activate openclaw
验证安装
import openclaw print(openclaw.__version__)
常见问题解决
证书问题
# 临时忽略SSL验证 pip install --trusted-host pypi.tuna.tsinghua.edu.cn openclaw # 永久解决 pip config set global.trusted-host "pypi.tuna.tsinghua.edu.cn mirrors.aliyun.com"
权限问题
# 使用用户安装 pip install --user openclaw # 或使用虚拟环境 python -m venv venv source venv/bin/activate pip install openclaw
依赖冲突
# 尝试指定版本 pip install "openclaw>=1.0,<2.0" # 或清理后重装 pip uninstall openclaw -y pip cache purge pip install openclaw
国内镜像站汇总
| 镜像站 | 网址 | 适用场景 |
|---|---|---|
| 阿里云 | mirrors.aliyun.com | 系统包、Docker、PyPI |
| 清华大学 | mirrors.tuna.tsinghua.edu.cn | 系统包、PyPI、Conda |
| 中科大 | mirrors.ustc.edu.cn | 系统包、PyPI |
| 华为云 | mirrors.huaweicloud.com | 系统包、Docker |
| 腾讯云 | mirrors.cloud.tencent.com | 系统包 |
更新配置脚本
保存为 setup_openclaw.sh:

#!/bin/bash
echo "正在配置镜像源..."
# 配置pip镜像
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn
# 安装OpenClaw
echo "正在安装OpenClaw..."
pip install openclaw --upgrade
# 验证安装
python -c "import openclaw; print(f'OpenClaw版本: {openclaw.__version__}')"
赋予执行权限:
chmod +x setup_openclaw.sh ./setup_openclaw.sh
注意: 具体镜像源地址请根据网络状况选择,境外服务器可忽略镜像配置,如遇网络问题,可尝试使用代理或切换其他镜像源。
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。