安装 uv 使用代理指南
在进行运行 安装 uv 脚本时,如果无法直连 GitHub ,可以通过设置代理来解决。
以下方法均使用 https://ghfast.top/ 作为例子。
使用方法
指定 uv 版本
方法1:设置环境变量(推荐)
# 设置 GitHub 代理(注意末尾不要加 / )
export UV_INSTALLER_GITHUB_BASE_URL="https://ghfast.top/https://github.com"
# 运行安装脚本
curl -LsSf https://ghfast.top/https://github.com/astral-sh/uv/releases/download/$UV_VERSION/uv-installer.sh | sh
方法2:直接设置下载URL
# 直接指定下载URL前缀
export UV_DOWNLOAD_URL="https://ghfast.top/https://github.com/astral-sh/uv/releases/download/$UV_VERSION"
# 运行安装
curl -LsSf $UV_DOWNLOAD_URL/uv-installer.sh | sh
方法3:下载后本地执行
# 先下载安装脚本
curl -o uv-installer.sh https://ghfast.top/https://github.com/astral-sh/uv/releases/download/$UV_VERSION/uv-installer.sh
# 设置代理环境变量后执行
export UV_INSTALLER_GITHUB_BASE_URL="https://ghfast.top/https://github.com"
chmod +x uv-installer.sh
./uv-installer.sh
常见问题
-
代理地址格式错误:确保使用
https://ghfast.top/https://github.com
而不是https://ghfast.top/
-
证书问题:如果遇到 SSL 证书错误,可以添加
-k
参数忽略证书验证(不推荐) -
下载速度慢:尝试不同的代理地址,选择速度最快的
-
架构检测失败:手动指定架构下载对应的安装包