Navigation
- index
- modules |
- next |
- previous |
- Python »
- 3.16.0a2 documentation »
- Extending and Embedding the Python Interpreter »
- Building C and C++ Extensions
- |
- Theme |
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.
Table of Contents
Previous topic
Defining Extension Types: Assorted Topics
Next topic
Building C and C++ Extensions on Windows
This page
«Navigation
- index
- modules |
- next |
- previous |
- Python »
- 3.16.0a2 documentation »
- Extending and Embedding the Python Interpreter »
- Building C and C++ Extensions
- |
- Theme |
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 29, 2026 (04:54 UTC). Found a bug?
Created using Sphinx 9.1.1.