Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Python ssl module on Windows?

Tags:

The Google App Engine Launcher tells me:

WARNING appengine_rpc.py:399 ssl module not found. Without the ssl module, the identity of the remote host cannot be verified, and connections may NOT be secure. To fix this, please install the ssl module from http://pypi.python.org/pypi/ssl .

I downloaded the package and it contained a setup.py file. I ran:

python setup.py install 

and then:

Python was built with Visual Studio 2003; blablabla use MinGW32 

Then I installed MinGW32 and now the compilation doesn't work. The end of the compilation errors contains:

ssl/_ssl2.c:1561: error: `CRYPTO_LOCK' undeclared (first use in this function)

error: command 'gcc' failed with exit status 1

What should I do?

like image 556
Jader Dias Avatar asked Feb 14 '10 16:02

Jader Dias


People also ask

How do I fix ssl module is not available in Python?

The problem can be caused by DLLs in the Windows\System32 folder (e.g. libcrypto-1_1-x64. dll or libssl-1_1-x64. dll or others) placed there by other software. The fix was installing openSSL from https://slproweb.com/products/Win32OpenSSL.html which replaces the dlls by more recent versions.

How do I enable ssl in Python?

Simple HTTPS Server using Python Also on Windows, go to https://indy.fulgan.com/SSL/openssl-1.0.2t-x64_86-win64.zip, and unzip. Afterwards on both Windows and Linux, type this command and hit enter. (This is the only command you need in Linux, but you need to do previous steps in Windows.) Copy created key.

What is the use of ssl module in Python?

This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library.


1 Answers

Grab the openssl and libgw32c packages from the gnuwin32 project (download the "Developer files"!) and extract them where you installed gnuwin32 - or if you don't have gnuwin32 tools yet, you can extract it anywhere (e.g. "C:\Program Files\gnuwin32"). Enter the gnuwin32 directory in the "setup.py" file (replace "C:\Utils\GnuWin32" in line 154).

Then you can build the ssl module without problems. I tested it myself, using GCC "4.3.2-tdm-2 mingw32" and with the command line setup.py build -cmingw32 (-cmingw32 forces MinGW as I also have Microsoft's compiler installed). Execute setup.py install after the successful build to install ssl.

like image 54
AndiDog Avatar answered Oct 25 '22 22:10

AndiDog