[Distutils] What do I need to run setup.py on Windows?

Mark Sienkiewicz sienkiew at stsci.edu
Tue Feb 14 00:04:43 CET 2012


Hi,

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 
numpy.org.

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 
http://www.microsoft.com/download/en/details.aspx?id=18950

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 
errors.

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 
this:

c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL 
/nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Pyth
on27\PCbuild /EXPORT:init_combine 
build\temp.win32-2.7\Release\src/_combinemodule.obj 
/OUT:build\lib.win32-2.7\stsci\image\_combine.
pyd /IMPLIB:build\temp.win32-2.7\Release\src\_combine.lib 
/MANIFESTFILE:build\temp.win32-2.7\Release\src\_combine.pyd.manifest
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?

Mark S.



More information about the Distutils-SIG mailing list