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
浙公网安备 33010602011771号