Make configure.py work with Python. Fixes issue #877.

Patch from @TheOneRing!