Building PyCrypto-2.5 using MinGW and Python 2.7 on Windows XP

Hi there!

It took me some time to figure this out. I hope this page provides the info that you require. What I wanted to do was to install PyCrypto ( on Windows XP. Due to law restrictions, the PyCrypto website doesn’t supply binaries. I have the Python 2.7.2 installed and MinGW as compiler. For more information about setting up Python and MinGW, see my previous post.

First I tried to use the ‘so called’ easy_install setuptools method: easy_install pycrypto

Nice try, but no cigar. Apparently there’s more to it, since it fails with the following error:
error: Unable to find vcvarsall.bat

Well at least we know where the PyCrypto source package came from. 🙂

  1. After downloading the package, open a windows command prompt.
  2. Move to the directory which contains the source.
  3. Extract the package: tar -zxvf pycrypto-2.5.tar.gz
  4. Move to the new directory: cd pycrypto-2.5
  5. Build the package: python build -c mingw32
  6. Install the package: python install
  7. Tip: If you want to build binary installable package which you can distribute, execute the following command: python bdist_wininst

If the building is successful, you can find the executable in the ‘dist’ directory named: ‘pycrypto-2.5.win32-py2.7

This entry was posted in MinGW, Programming, Python. Bookmark the permalink.

5 Responses to Building PyCrypto-2.5 using MinGW and Python 2.7 on Windows XP

  1. cinhoo says:

    Thanks for your binary!

  2. Varadarajan Araavamudhan says:

    Thank you. This was very helpful. I did download the binaries and did not work. This one made it work.

  3. Pingback: Install PyCrypto for Windows in less than 5 minutes | Leo Celis

  4. Himanshu says:

    Man, you are awesome, I am new to Python and to scripting languages overall and this is the only effort on net (apart from Stackflow) where everything is explicitly explained, I can even teach my 10 yr old with this info.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.