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
总结
到此这篇关于python清华pip镜像源报HTTP error 403错误解决的文章就介绍到这了,更多相关清华pip镜像源报HTTP error 403内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
python subprocess pipe 实时输出日志的操作
这篇文章主要介绍了python subprocess pipe 实时输出日志的操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2020-12-12
python让图片按照exif信息里的创建时间进行排序的方法
这篇文章主要介绍了python让图片按照exif信息里的创建时间进行排序的方法,涉及Python操作图片exif获取信息的技巧,需要的朋友可以参考下2015-03-03


最新评论