Using distutils in Windows XP / "Python in a Nutshell"

B

Blair LeGent

Following the directions in "Python in a Nutshell" (an excellent book),
I entered the C code for "helloworld.c", saved it as a file, and entered
this script and saved it as setup.py:

from distutils.core import setup, Extension
setup(name='helloworld', ext_modules= [
Extension('helloworld',sources=['helloworld.c'])])

Then, following directions, I type "python setup.py install" from a C:\>
prompt. I get these messages:

running install
running build
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

....but the .NET Framework IS installed; the latest version, in fact, SDK
v2.0, part of the Visual Studio 2005 beta I've got. From poking around
the Internet it looks like I'm supposed to (a) monkey with my registry,
(b) install an OLD version of the SDK, (c) screw around with distutils
source code, or (d) switch to Linux. Nowhere do I find a clear solution
to my problem, though. Can anyone help? Should we submit an errata to
O'Reilly?
 
E

Edward Elliott

Blair said:
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

...but the .NET Framework IS installed

Just a guess, but is the C compiler in your PATH when you run python? I'm
assuming python on xp still uses environment variables and not some
windows-specific method for locating binaries.
 
A

Alex Martelli

Blair LeGent said:
Following the directions in "Python in a Nutshell" (an excellent book),
Thanks!

I entered the C code for "helloworld.c", saved it as a file, and entered
this script and saved it as setup.py:

from distutils.core import setup, Extension
setup(name='helloworld', ext_modules= [
Extension('helloworld',sources=['helloworld.c'])])

Then, following directions, I type "python setup.py install" from a C:\>
prompt. I get these messages:

running install
running build
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

...but the .NET Framework IS installed; the latest version, in fact, SDK
v2.0, part of the Visual Studio 2005 beta I've got. From poking around
the Internet it looks like I'm supposed to (a) monkey with my registry,
(b) install an OLD version of the SDK, (c) screw around with distutils
source code, or (d) switch to Linux. Nowhere do I find a clear solution
to my problem, though. Can anyone help? Should we submit an errata to
O'Reilly?

No need: the second edition (forthcoming!) does explain that the
compiler you need to build Python extensions (for 2.4 and 2.4) is VS
2003. I don't belabor on the hows and whys of VS2005 not being
supported -- I'm not into Windows (over the last few years) to grok them
fully. <http://www.vrplumber.com/programming/mstoolkit/> explains one
way to avoid shelling out $$$ to MS while still being able to build
Python extensions -- and just today I asked on this very group about
where to find VS 20003 Toolkit (it's not at its original location
indicated at the above URL, any more!) and was promptly answere with a
URL that worked just fine.


Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top