[Distutils] What do I need to run setup.py on Windows?
sienkiew at stsci.edu
Tue Feb 14 00:04:43 CET 2012
I'm trying to use "setup.py install" to install python packages that
include C extensions. I have Windows/XP, the 32 bit Python 2.7 binary
downloaded from python.org and the 32 bit numpy binary downloaded from
I don't seem to be able to get a working C compiler.
At first, I read that you need Microsoft Visual Studio Express 2008.
This is a 32 bit only C/C++ compiler, but that is ok because the Python
and Numpy that I need are 32 bit executables.
Well, I still get errors about a missing "basetsd.h". The solution I
found online is to install "Windows SDK", which I found at
The heading at the top of the page says "Windows 7", but under
"Supported Operating Systems" it lists Windows/XP.
I still get errors because basetsd.h is not found. In the interests of
seeing if anything works at all, I made an empty file named
c:\Python27\include\basetsd.h hoping I might get to see some different
I did. Apparently, basetsd.h does not contain anything I need, because
"setup.py build" can compile the C code now. The link stage fails like
c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
/nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Pyth
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
error: command '"c:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\link.exe"' failed with exit status 1104
So, somehow I need to have basetsd.h and kernel32.lib; neither of them
is provided by the compiler and neither is provided by Windows SDK.
I've run out of ideas about where to look for documentation and what
other things to try. Can anybody offer me any suggestions?
More information about the Distutils-SIG