目录

解决pip安装uv时下载速度慢

解决pip安装uv时下载速度慢

验证优化效果

https://i-blog.csdnimg.cn/direct/db2aaa7a43234633aeb40fcfaf1867da.png

方案 1:临时使用国内镜像源(推荐)

pip install uv -i https://pypi.tuna.tsinghua.edu.cn/simple
  • 速度提升 :镜像源服务器位于国内,带宽充足,通常可达 1-10MB/s
  • 支持源列表
# 清华源(推荐)
-i https://pypi.tuna.tsinghua.edu.cn/simple
# 阿里云源
-i https://mirrors.aliyun.com/pypi/simple
# 豆瓣源
-i https://pypi.douban.com/simple
方案 2:永久配置镜像源
# 创建配置文件(Linux/macOS)
mkdir -p ~/.pip
echo "[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn" > ~/.pip/pip.conf
  • 验证生效 :后续所有 pip install 命令自动使用该源

常见问题补充

  1. SSL 证书错误 :添加 --trusted-host 参数
pip install uv -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
  1. 包哈希校验失败 :尝试更换其他镜像源
  2. 版本兼容性问题 :使用 pip install uv==0.6.5 指定旧版本