常用的国内镜像源

常见的 pip 镜像源

阿里云镜像:https://mirrors.aliyun.com/pypi/simple/
清华大学镜像:https://pypi.tuna.tsinghua.edu.cn/simple
中国科学技术大学镜像:https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣镜像:https://pypi.doubanio.com/simple/
华为云镜像:https://mirrors.huaweicloud.com/repository/pypi/simple

为什么有的镜像源需要加--trust参数才能下载?

主要是以下原因:

安全协议问题: 当镜像源使用的是 HTTP 协议而非 HTTPS 协议时,pip 会认为该镜像源不是一个受信任的安全主机。这是因为 HTTP 协议不提供加密和身份验证功能,存在被中间人攻击的风险,可能导致下载的包被篡改或注入恶意代码。

eg: http://mirrors.aliyun.com/pypi/simple/下载包时就可能出现这种情况,需要添加--trusted-host mirrors.aliyun.com参数来告知 pip 信任该主机。

证书验证问题: 如果镜像源的 SSL 证书存在问题,比如证书过期、证书由不受信任的证书颁发机构签发等,pip 也会将其视为不信任的源。这种情况下,即使镜像源使用的是 HTTPS 协议,也需要添加--trust参数来跳过证书验证,以便能够从该镜像源下载包。

相关推荐
hui函数1 小时前
Python系列Bug修复|如何解决 pip install 安装报错 invalid command ‘bdist_wheel’(缺少 wheel)问题
python·bug·pip
hui函数1 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有索引未设为 trusted-host 导致拒绝 问题
python·bug·pip
hui函数2 小时前
Python系列Bug修复|如何解决 pip install 安装报错 Backend ‘setuptools.build_meta’ 不可用 问题
python·bug·pip
hui函数4 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有仓库认证失败 401 Unauthorized 问题
python·bug·pip
hui函数4 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 子目录可编辑安装缺少 pyproject.toml 问题
python·bug·pip
hui函数21 小时前
如何解决 pip install 编译报错 g++: command not found(缺少 C++ 编译器)问题
开发语言·c++·pip
hui函数1 天前
Python系列Bug修复|如何解决 pip install -e . 安装报错 “后端不支持可编辑安装(PEP 660)” 问题
python·bug·pip
hui函数1 天前
如何解决 pip install 网络报错 403 Forbidden(访问被阻止)问题
网络·pip
一尘之中1 天前
在Ubuntu 22.04中高效使用pip:从入门到精通
ubuntu·pip·ai写作
hui函数1 天前
如何解决 PyCharm 控制台 pip install 报错 OSError: [Errno 122] Disk quota exceeded 问题
ide·pycharm·pip