Home > Backend Development > Python Tutorial > Solution to pip error SSLError (\'Can\'t connect to HTTPS URL because the SSL module is not available.\')

Solution to pip error SSLError (\'Can\'t connect to HTTPS URL because the SSL module is not available.\')

PHPz
Release: 2024-02-29 21:31:37
forward
640 people have browsed it

Solution to pip error SSLError (\Can\t connect to HTTPS URL because the SSL module is not available.\)

Cause of error

In python, if "SSLError("Can't connect to https URL appears because the SSL module is not available.")" error is usually caused by the lack of OpenSSL library in the system. This library is used to implement the SSL/TLS protocol. Therefore, before installing pip, you need to install the OpenSSL library first.

How to solve

You can use the following methods to solve this problem:

Use the pre-compiled version: In windows, you can download the pre-compiled version OpenSSL library.

Installing via a package manager: In linux or MacOS, you can use a package manager to install the OpenSSL library. For example, in ubuntu you can use the command "sudo apt-get install libssl-dev" to install the OpenSSL library.

Install from source code: If none of the above methods solve the problem, you can install the OpenSSL library from source code.

After installing the OpenSSL library, you can use pip normally.

Usage Example

Of course, the following is an example of installing the OpenSSL library in an Ubuntu system:

sudo apt-get update
sudo apt-get install libssl-dev
Copy after login

The installation is successful, and then you can run the pip command.

For example:

pip install numpy
Copy after login

Download the precompiled version of the OpenSSL library for Windows at Https://slproWEB.com/products/Win32OpenSSL.html The corresponding version of the OpenSSL library.

After the installation is complete, you need to put the OpenSSL DLL file in the PATH directory of the system, or put the DLL file in the Python installation directory.

The above is the detailed content of Solution to pip error SSLError (\'Can\'t connect to HTTPS URL because the SSL module is not available.\'). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:lsjlt.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template