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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Blair LeGent

    #1

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

    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='hel loworld', ext_modules= [
    Extension('hell oworld',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?
  • Edward Elliott

    #2
    Re: Using distutils in Windows XP / "Python in a Nutshell"

    Blair LeGent wrote:[color=blue]
    > error: The .NET Framework SDK needs to be installed before building
    > extensions for Python.
    >
    > ...but the .NET Framework IS installed[/color]

    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.

    Comment

    • Alex Martelli

      #3
      Re: Using distutils in Windows XP / "Python in a Nutshell"

      Blair LeGent <blergent@ftml. net> wrote:
      [color=blue]
      > Following the directions in "Python in a Nutshell" (an excellent book),[/color]

      Thanks!
      [color=blue]
      > 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='hel loworld', ext_modules= [
      > Extension('hell oworld',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?[/color]

      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.c om/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

      Comment

      Working...