Home > Backend Development > Python Tutorial > How to Fix the 'SSL: TLSV1_ALERT_PROTOCOL_VERSION' Error When Installing Python Packages?

How to Fix the 'SSL: TLSV1_ALERT_PROTOCOL_VERSION' Error When Installing Python Packages?

Patricia Arquette
Release: 2024-12-08 08:06:15
Original
563 people have browsed it

How to Fix the

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:

  1. Run the following command to upgrade pip:

    curl https://bootstrap.pypa.io/get-pip.py | python
    Copy after login
    Copy after login

    Note: Sudo may be required if you are not in a virtual environment.

  2. If you encounter a鸡-and-egg issue, use the following workaround:

    pip install --no-cache-dir --upgrade pip
    Copy after login

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:

  1. Activate your virtual environment:

    source ./venv/bin/activate
    Copy after login
  2. Upgrade pip:

    curl https://bootstrap.pypa.io/get-pip.py | python
    Copy after login
    Copy after login
  3. Restart PyCharm and verify the Python interpreter in Preferences.

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template