Building Python extensions from sources on Windows

TPJ tprimke at interia.pl
Sat Mar 25 05:36:38 EST 2006


Hello, I have another, probably stupid, question.

I'm working on some Python project, and I use some extensions written
in C. I do all the development on my GNU/Linux box, so my setup.py
script works just as it's supposed to work on a GNU/Linux system. But
in the nearest future I'll have to make an executable program for
Windows.

I know, that there are some useful tools to make executables from
Python programs for Windows (Py2Exe, PyInstaller - that's what I have
heard about), but, as far as I understand the subject, I'll need the
extensions modules (dll files? on my GNU/Linux system I always get some
so files - shared libraries) in the compiled form in order to make any
executable program.

In the Python standard documentation I have read, that:

"(...) Since the metadata is taken from the setup script, creating
Windows installers is usually as easy as running:

python setup.py bdist_wininst
(...)

If you have a non-pure distribution, the extensions can only be created
on a Windows platform, and will be Python version dependent. (...)"

And that's the problem: I understand the fact, that in order to build a
non-pure distrubution, all the C sources have to be compiled (to dll
libraries?). But there's the problem: I don't know which one compiler
should I use. Do I have to use the same compiler, that the Python has
been compiled with? If so, which one of the Windows compilers has been
used to compile Python?

Or perhaps could I use an another compiler? Which one, then?

I have no idea what to do. I haven't done anything on Windows for so
long...




More information about the Python-list mailing list