?驗證優化效果
方案 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
命令自動使用該源?
常見問題補充
- SSL 證書錯誤:添加
--trusted-host
參數
pip install uv -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
- 包哈希校驗失敗:嘗試更換其他鏡像源?
- 版本兼容性問題:使用
pip install uv==0.6.5
指定舊版本?