GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Table of Contents
  • Building C and C++ Extensions
  • Defining Extension Types: Assorted Topics
  • Building C and C++ Extensions on Windows
  • Report a bug
  • Improve this page
  • Show source
  • index
  • modules
  • Python
  • 3.15.2 documentation
  • Extending and Embedding the Python Interpreter

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — Building C and C++ Extensions

Building C and C++ Extensions¶

A C extension for CPython is a shared library (for example, a .so file on Linux, .pyd on Windows), which exports an initialization function.

See Defining extension modules for details.

Building C and C++ Extensions with setuptools¶

Building, packaging and distributing extension modules is best done with third-party tools, and is out of scope of this document. One suitable tool is Setuptools, whose documentation can be found at https://setuptools.pypa.io/en/latest/setuptools.html.

The distutils module, which was included in the standard library until Python 3.12, is now maintained as part of Setuptools.

© Copyright 2001 Python Software Foundation.
This page is licensed under the Python Software Foundation License Version 2.
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

The Python Software Foundation is a non-profit corporation. Please donate.

Last updated on Nov 12, 2026 (08:53 UTC). Found a bug?
Created using Sphinx 9.1.1.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.