Python中pip安裝包出現Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection


Python使用pip安裝程序報錯:

  Collecting sphinx
    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/sphinx/
    Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/sphinx/
    Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/sphinx/
    Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/sphinx/
    Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/sphinx/


報錯原因:

可能是連接國外鏡像源超時導致(使用pip默認鏡像源安裝模塊一直比較慢)

解決辦法:

改為國內鏡像源下載

  清華:https://pypi.tuna.tsinghua.edu.cn/simple/
  阿里雲:http://mirrors.aliyun.com/pypi/simple/
  中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
  華中理工大學:http://pypi.hustunique.com/
  山東理工大學:http://pypi.sdutlinux.org/
  豆瓣:http://pypi.douban.com/simple/

使用阿里鏡像源進行安裝

  pip install sphinx sphinx-autobuild sphinx_rtd_theme -ihttp://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

參數說明:

  pip install sphinx sphinx-autobuild sphinx_rtd_theme  -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
  sphinx sphinx-autobuild sphinx_rtd_theme 需要安裝的包名
  -i 指定鏡像源地址
  --trusted-host :后邊指的是host,例阿里鏡像源地址為 http://mirrors.aliyun.com/pypi/simple/,host就是指http://和/之間的部分,即mirrors.aliyun.com


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM