Building psycopg2 for Python 2.6-ish on Windows XP

Here’s what worked for me.

  • Download and install MinGW.
  • Add x:\mingw\bin to your PATH. (Right click My Computer | Advanced tab | Environment Variables | Select ‘Path’ from the ‘System variables’ list | Edit | Append ‘;x:\mingw\bin’ to the end of the string in ‘Variable value’)
  • Download and execute the PostgreSQL one-click installer.
  • Download and extract psycopg2
  • From within the extracted psycopg2 directory, execute the following command:
    python setup.py build_ext --compiler=mingw32 build

Your goodies will be in the local build directory.

One comment.

  1. Final step:
    python setup.py build_ext –compiler=mingw32 install

Post a comment.