python-pip更改下载路径,解决超时问题

有时pip安装包时,会提示

pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

原因跟解决方式

PyPI镜像:考虑使用PyPI的镜像站点。中国用户经常遇到与files.pythonhosted.org的连接问题,因此他们经常使用清华大学的PyPI镜像。你可以设置pip使用镜像站点,例如:

bash

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

设置后,pip会从这个镜像站点而不是默认的files.pythonhosted.org下载包。

 

常用的其它镜像有

地址 归属
http://mirrors.aliyun.com/pypi/simple/ 阿里云
http://pypi.douban.com/simple/ 豆瓣
http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学
https://pypi.mirrors.ustc.edu.cn/simple/ 中国科技大学
https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学
pip默认镜像地址:
https://pypi.org/simple

ini文件位置

windos:C:\Users\z6776\AppData\Roaming\pip

liunx系统:~/.pip/pip.conf

mac os系统 ~/.pip/pip.conf

 

posted @   坚固的大兴  阅读(282)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示