pig 下载出现 下列警告
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))'
可能原因
1、网络问题,pip默认的镜像,是外网的在国内很慢,所以我们可以通过设置下载路径,
通过国内的镜像入如:阿里云下载,不仅下载快,而且不会下着下着报错了
2、windows系统使用了全局代理
python 旧版的 urllib 在生成https代理变量的时候会把本地的http代理添加为https。
解决
网络问题
在windows系统上,C:\Users\用户名(如:瞑,如图)
然后我们在瞑这个文件夹下创建文件夹pip,然后在创建pip.ini(创建txt文件->复制下面的代码->改后缀)文件,然后输入下列
我这里的是阿里的镜像,下面也有很多国内的优秀镜像可供选择
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
阿里云镜像源:http://mirrors.aliyun.com/pypi/simple/
中国科技大学镜像源: https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣镜像源: http://pypi.douban.com/simple/
清华大学镜像源:https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学镜像源:http://pypi.mirrors.ustc.edu.cn/simple/
windows系统使用了全局代理,python 旧版的urllib 在生成https代理变量的时候会把本地的http代理添加为https。
我们先打开PyCharm
import urllib.request
proxies = urllib.request.getproxies()
右键点击getproxies()
然后我们就进入了这个页面
把原来的注释掉,改为第二行的
# proxies['https'] = 'https://%s' % proxyServer
proxies['https'] = 'http://%s' % proxyServer
最后点击保存,关掉刷新一下,就可以了
我这里只介绍我用的方法,因为比赛就是这个python环境,如果你在不乎版本,我建议是直接将它升级,还有多种解决方法,我是参考了这位大神:【Python】pip intall 遇到了WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) - 瑞尔小透 - 博客园 (cnblogs.com)https://www.cnblogs.com/RexTooru/p/17303168.html