Overcoming SSL Errors When Installing Python Packages
While attempting to install a Python library using pip, you may encounter an SSL error: "[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version." This issue stems from the recent deprecation of TLS versions 1.0 and 1.1 on Python.org sites.
Solution
To resolve this error, upgrade pip using the following command:
curl https://bootstrap.pypa.io/get-pip.py | python
Note that using "pip install --upgrade pip" might not upgrade pip correctly due to the requirement for TLS versions 1.2 or later.
Additional Considerations for PyCharm Users
For those using PyCharm with virtual environments, follow these steps:
curl https://bootstrap.pypa.io/get-pip.py | python
The above is the detailed content of How to Fix '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version' Errors When Installing Python Packages?. For more information, please follow other related articles on the PHP Chinese website!