1. 程式人生 > >解決pip安裝出現sslerror的問題

解決pip安裝出現sslerror的問題

錯誤程式碼如下

Collecting slwt
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
 after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAI
LED] certificate verify failed (_ssl.c:661)'),)': /simple/slwt/
  Retrying (Retry(total=3, connect=None, read=None
, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAI LED] certificate verify failed (_ssl.c:661)'),)': /simple/slwt/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'
[SSL: CERTIFICATE_VERIFY_FAI LED] certificate verify failed (_ssl.c:661)'),)': /simple/slwt/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAI LED] certificate verify failed (_ssl.c:661)'),)'
: /simple/slwt/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAI LED] certificate verify failed (_ssl.c:661)'),)': /simple/slwt/ Could not fetch URL https://pypi.org/simple/slwt/: There was a problem confirm ing the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max ret ries exceeded with url: /simple/slwt/ (Caused by SSLError(SSLError(1, u'[SSL: CE RTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)) - skipping Could not find a version that satisfies the requirement slwt (from versions: ) No matching distribution found for slwt

正確解決方法:

    pip install lightgbm -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
  • 其中lightgbm是想要安裝的包