Fix for "Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]" Error
When encountering the "SSL: TLSV1_ALERT_PROTOCOL_VERSION" error while installing Python packages using pip, the issue stems from outdated TLS protocols in pip. To resolve this problem, upgrade pip to the latest version.
Upgrade Procedure:
Run the following command to upgrade pip:
curl https://bootstrap.pypa.io/get-pip.py | python
Note: Sudo may be required if you are not in a virtual environment.
If you encounter a鸡-and-egg issue, use the following workaround:
pip install --no-cache-dir --upgrade pip
Reason for Issue:
This error occurs because Python.org sites have discontinued support for TLS versions 1.0 and 1.1. TLS 1.2 or higher is now mandatory. Pip has recently implemented this change, which has resulted in the error.
For PyCharm (Virtualenv) Users:
Activate your virtual environment:
source ./venv/bin/activate
Upgrade pip:
curl https://bootstrap.pypa.io/get-pip.py | python
The above is the detailed content of How to Fix the 'SSL: TLSV1_ALERT_PROTOCOL_VERSION' Error When Installing Python Packages?. For more information, please follow other related articles on the PHP Chinese website!