Home >Backend Development >Python Tutorial >How to Fix '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version' Errors When Installing Python Packages?

How to Fix '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version' Errors When Installing Python Packages?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-13 18:36:11472browse

How to Fix

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:

  1. Activate the virtual environment using its shell.
  2. Run the upgrade command:
curl https://bootstrap.pypa.io/get-pip.py | python
  1. After upgrading pip, restart PyCharm and verify the Python interpreter in the Preferences.

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn