Re: Help with C extensions under VC6 / WinXP and Python 2.4

From: Fredrik Lundh (fredrik_at_pythonware.com)
Date: 02/17/05


To: python-list@python.org
Date: Thu, 17 Feb 2005 08:51:54 +0100


"Scott" <scott+python@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>



Relevant Pages

  • Re: distutils and data files
    ... I have a slightly messy python program I wrote that I've historically ... I need something that could work from both the extracted source ... install command. ... maybe the distutils module now incorporates a similar ...
    (comp.lang.python)
  • Python language extension mechanism for Python 3000... Worth for PEP?
    ... Introduction of the mechanism for language extensions via ... Python could be done via special interpreter extensions. ...
    (comp.lang.python)
  • Mac OS distultils probelm
    ... I'm working on a python extension module that I'm trying to install ... The linker command that distutils spits out looks somewhat like this ... symbol came out of the AGL framework and thus look for it there. ...
    (comp.lang.python)
  • ANNOUNCE: Build 200 of the pywin32 extensions (win32all) available
    ... I have released a new version of the win32all extensions. ... using the distutils builtin binary installer - WISE is no longer used. ... * There is now a single build number for all supported Python versions. ...
    (comp.lang.python)
  • Re: Python Extension Building Network
    ... Windows binaries for any Python extension developer that needs them, ... others are pretty finicky and some extensions don't come with tests. ... There are no directions on how to use Visual Studio 2003 that I've ... pick up the installer in the build\ directory. ...
    (comp.lang.python)