Help with C extensions under VC6 / WinXP and Python 2.4

Fredrik Lundh fredrik at pythonware.com
Thu Feb 17 02:51:54 EST 2005


"Scott" <scott+python at CS.Princeton.EDU> wrote:

> >>The trouble I have is that there are no PC or PCbuild
> >>subdirectories in C:\Python24.  Where do I find these?
> >
> >
> > As the quoted URL says (2nd para):
> > """
> > To build extensions using these instructions, you need to have a copy
> > of the Python sources of the same version as your installed Python.
> > [snip]
> > The example files described here are distributed with the Python
> > sources in the PC\ example_nt\ directory
> > """
> >
> > i.e. you have to download a copy of the Python source distribution.
>
> Since I had an include directory, I assumed (incorrectly) that
> I already had the sources.  Thanks for the reiteration -- it's
> what I needed.

here's another iteration: the top of that page says:

    "There are two approaches to building extension modules on Windows,
    just as there are on Unix: use the distutils package to control the
    build process, or do things manually. The distutils approach works
    well for most extensions; documentation on using distutils to
    build and package extension modules is available in "Distributing
    Python Modules". This section describes the manual approach to
    building Python extensions written in C or C++. "

if you're not 100% sure what you're doing, and why you need to use the
manual approach (you don't), *please* use the distutils solution.  here's
a minimal setup script:

from distutils.core import setup, Extension

setup(
    name="mymodule",
    ext_modules = [Extension("mymodule", ["mymodule.c"])]
    )

to build, use "python setup.py build".  to build a local copy ("in place"), use
"python setup.py build_ext -i".  to build and install, use "python setup.py
install".

no need to download any extra stuff; it just works.

</F> 






More information about the Python-list mailing list