pip出错,提示WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None))

命令pip install *或命令python3 -m pip install --upgrade pip提示信息:
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)’))’: /simple/pip/

命令pip show pip提示信息:
/system/python/lib/python3.7/site-packages/pip/_vendor/urllib3/connection.py:340: SystemTimeWarning: System time is way off (before 2017-06-30). This will probably lead to SSL verification errors SystemTimeWarning Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.tuna.tsinghua.edu.cn’, port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)’))) - skipping

问题分析:
可能是由于主板上用于保存内部时钟的纽扣电池没电或松动导致的本机与服务器时间不同步的问题。
解决方案(Linux):1
利用ntpdate与互联网上的ntp服务器同步硬件时间
ntpdate -u 210.72.145.44

ntpdate ntp.api.bz
如果出现如下提示:

1 Jan 08:18:27 ntpdate[1830]: no server suitable for synchronization found

则表示同步失败
出现如下提示:

12 Jun 00:40:39 ntpdate[1831]: step time server 114.118.7.161 offset 1591892511.869846 sec

则同步成功
再使用date命令查看时间时,应该恢复正常,且pip也可以正常更新、安装。

*思路来源:StackOverflow2

References


  1. ntpdate同步更新时间_luchuangao ↩︎

  2. How to install pip for installing external packages in NAO robot_Shubham Verma ↩︎

你可能感兴趣的:(pip,linux)