Problem:
When attempting to install Python packages using pip, an SSL error is encountered, particularly with the message "[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version."
Explanation:
This error stems from a TLS version deprecation for pip. Python.org sites no longer support TLS versions 1.0 and 1.1, leading to TLS protocol version mismatch errors.
Solution:
1. Upgrade Pip Externally:
Run the following command to upgrade pip using a direct download and installation method:
curl https://bootstrap.pypa.io/get-pip.py | python
Note: If using a virtual environment, you may need to prefix the command with sudo python.
2. Upgrade Pip in PyCharm (Virtualenv):
source ./venv/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python
After upgrading pip, it should resolve the TLS protocol version mismatch error and allow you to install Python packages successfully.
The above is the detailed content of How to Fix the PIP SSL Error: 'SSL: TLSV1_ALERT_PROTOCOL_VERSION'?. For more information, please follow other related articles on the PHP Chinese website!