python安装库失败

2019-11-07  本文已影响0人  seeiy
root@xxxx:/zy/xxe# python3 -m pip install certifi -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple/
Collecting certifi
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0xb646308c>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/certifi/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0xb646370c>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/certifi/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0xb6463f4c>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/certifi/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0xb63f75ac>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/certifi/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0xb63f7f0c>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/certifi/
  ERROR: Could not find a version that satisfies the requirement certifi (from versions: none)
ERROR: No matching distribution found for certifi

最近老是遇到这个问题,刚开始以为是因为库在国外的原因,但是换到国内的源依然报这个错,之后才发现是因为linux的DNS服务的原因,最近公司的DNS服务器老是出问题,修改了linux的dns配置文件指定了8.8.8.8作为DNS服务器才正常安装。

linuxDNS配置文件位置:

/etc/resolv.conf

格式:

nameserver 8.8.8.8
上一篇下一篇

猜你喜欢

热点阅读