> pip install xlrd
# 报错
Collecting xlrd  
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: \[Errno 65\] No route to host',)': /simple/xlrd/  
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: \[Errno 65\] No route to host',)': /simple/xlrd/

修改默认的源配置

  • linux下
    需要创建或修改配置文件(一般都是创建),linux的文件在~/.pip/pip.conf,
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
  • windows下
    直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。