Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]

前端 未结 17 2001
一整个雨季
一整个雨季 2020-11-21 13:16

I am trying to install a Python library using pip, getting an SSL error:

~/projects/base  pre-master±  pip install xdict

Collecting xdict
  Co         


        
17条回答
  •  情深已故
    2020-11-21 13:55

    Check your TLS version:

    python2 -c "import urllib2,json; print(json.loads(urllib2.urlopen('https://www.howsmyssl.com/a/check').read())['tls_version'])"
    

    If your TLS version is less than 1.2 you have to upgrade it since the PyPI repository is on a brownout period of deprecating early TLS.

    Source - Time To Upgrade Your Python: TLS v1.2 Will Soon Be Mandatory

    You can upgrade the TLS version using the following command:

    sudo apt-get update && sudo apt-get install openssl libssl-dev
    

    This should fix your problem. Good luck!

    EDIT: You can download packages using your own private python package repository regardless of TLS version. Private Python Package Repository

提交回复
热议问题