欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > python 清华pip镜像源报HTTP error 403

python 清华pip镜像源报HTTP error 403

2025/2/9 4:15:01 来源:https://blog.csdn.net/weixin_41934979/article/details/144265381  浏览:    关键词:python 清华pip镜像源报HTTP error 403

报错信息 

 ERROR: HTTP error 403 while getting https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/52/79/a64937a2185b91a96cc5406e3ea58120980c725543d047e112fb3084a972/fake_useragent-2.0.0-py3-none-any.whl (from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/fake-useragent/)

解决办法 

方法一:

临时更改镜像源(阿里镜像源)

 Package更换为自己所需安装的包

pip install -i http://mirrors.aliyun.com/pypi/simple Package --trusted-host mirrors.aliyun.com

方法二 

永久更换源(阿里镜像源)

pip config set global.index-url http://mirrors.aliyun.com/pypi/simple
pip config set install.trusted-host mirrors.aliyun.com

 方法三

配置多个镜像源(方法二设置后为默认镜像源,这里多个两个镜像源平衡负载,分别是清华大学源、豆瓣源)

pip config set global.extra-index-url "https://pypi.tuna.tsinghua.edu.cn/simple http://pypi.douban.com/simple"

 配置多个可信任主机(域名),分别为阿里、清华大学、豆瓣镜像域名

pip config set install.trusted-host "mirrors.aliyun.com mirrors.tuna.tsinghua.edu.cn pypi.douban.com"

最后清除缓存及时生效(方法二、方法三用到)

pip cache purge

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com