» Aug 19th, 2009, category: Python , Perm Link...

Bonus, If you don't want to do it by yourself, feel free to grab the Python SSL Binary Installer

Python SSL

Basically, Python support SSL by C extension module. In Python 2.6, there is new implementation with has significant changes and improvement. The problem is you want to use this thing with older Python version (2.5 and lower)

I need this to run Satchmo on Window.

I have googled to see if someone has already built it for but no luck. So let make it by ourself.

Which environment we will use

If you are linux guy who probably lost your way and need to use Window, you may go with Cygwin for this thing but if have some experience with Window and you will see that there is some different between Window and Linux. Because I'm building thing for Window, I better to go with Mingw. You can choose one you want and I recommended to see the original post at can see more detail at

Building Python extensions for Windows with only free tools

Install MinGW

The dependencies

To build the SSL, you need additional library and include file. I have tried to compile and fail and look at the error and fix the problem like trial and error, no magic here!

Below are libraries you will need,

Once you get all of them, unzip it to the directory you like and please don't forget it because we will need it later on.

For me, I unzip and place it at C:GnuWin32

Get the sorce code

Go to download the source code at http://pypi.python.org/pypi/ssl/ and extract to somewhere you want.

Modify setup.py

The original setup.py is assume that you place library at C:UtilsGnuWin32

    if sys.platform == 'win32':

        # Assume the openssl libraries from GnuWin32 are installed in the
        # following location:
        gnuwin32_dir = os.environ.get("GNUWIN32_DIR", r"C:\GnuWin32")

Go to line 152 and change you path you have extracted the files in.

Let build it

Go to directory you have extracted the source code,

  • To build the only, run command python setup.py build
  • To build and install, run command python setup.py install
  • To build the installer, run command python setup.py bdist_wininst

Troubleshot

If you can't import ssl because Python cannot load _ssl2, you need to delete init.py (site-packagesssl_init_.py) and import it agian. If you still fail, delete init.py and go the site-packages and import ssl at that location. That works for me.

See Python SSL "No module named _ssl2" for more detail.

Post your comment.

captcha