Skip to main content
CPython is the reference implementation of the Python programming language. Written in C and Python, it is the most widely used Python interpreter and serves as the standard against which all other Python implementations are measured.

What is CPython?

CPython is both an interpreter and a compiler that executes Python code. When you download Python from python.org, you’re getting CPython. It’s called “CPython” to distinguish it from other Python implementations like PyPy, Jython, or IronPython.
The name “CPython” comes from the fact that the interpreter is written in C, not because it’s related to C/C++ programming.

Why CPython Matters

CPython serves as the reference implementation for the Python language, which means:
  • Language Definition: CPython defines what “Python” means. The behavior of CPython is considered the canonical interpretation of Python language features
  • Standard Library: It includes the comprehensive Python standard library with over 200 modules
  • C API: Provides a robust C API for embedding Python in applications and extending it with C/C++ modules
  • Community Standard: Most Python packages and tools are developed and tested against CPython

Key Features

C Implementation

CPython’s core is written in C, providing:
  • Efficient execution of Python bytecode
  • Direct integration with system libraries and C extensions
  • Ability to embed Python in C/C++ applications
  • Access to low-level system capabilities

Comprehensive Standard Library

CPython comes with an extensive standard library that provides:
import os
import sys
import pathlib

# Work with files and directories
path = pathlib.Path('/usr/local/bin')
print(path.exists())

# System information
print(sys.version)
print(os.name)

Multi-Platform Support

CPython runs on virtually every modern platform:
  • Unix/Linux: All major distributions including Ubuntu, Fedora, Debian, RHEL
  • macOS: Full support including Apple Silicon (M1/M2/M3)
  • Windows: Windows 10, 11, and Server editions
  • BSD: FreeBSD, OpenBSD, NetBSD
  • Mobile: iOS and Android (experimental)

C API for Extensions

The CPython C API enables developers to:
  • Write performance-critical code in C
  • Create Python bindings for existing C/C++ libraries
  • Embed the Python interpreter in applications
  • Extend Python with custom built-in types
Popular packages like NumPy, pandas, and TensorFlow use the C API for performance-critical operations.

CPython vs Other Implementations

ImplementationDescriptionUse Case
CPythonReference implementation in CGeneral purpose, production use
PyPyPython implementation with JIT compilerPerformance-critical applications
JythonPython on the Java Virtual MachineJava integration
IronPythonPython for .NET framework.NET integration
MicroPythonPython for microcontrollersEmbedded systems

Version Information

This documentation covers CPython 3.15, which includes:
  • Enhanced performance optimizations
  • Improved error messages and debugging
  • Updated standard library modules
  • Security enhancements
  • Platform-specific improvements
To check your CPython version, run python --version or python3 --version in your terminal.

Architecture Overview

CPython’s execution model follows these steps:
1

Source Code Parsing

Your Python source code (.py files) is parsed into an Abstract Syntax Tree (AST)
2

Bytecode Compilation

The AST is compiled into Python bytecode (.pyc files)
3

Bytecode Execution

The CPython virtual machine executes the bytecode instructions
4

C Extension Calls

When needed, the interpreter calls into C extensions for performance-critical operations

Getting Started

Ready to start using CPython? Check out these resources:

Community and Support

CPython is developed by the Python Software Foundation and a global community of contributors:
CPython is the reference implementation. When reporting bugs or issues, make sure you’re using CPython and not another Python implementation.

License

CPython is open source software licensed under the Python Software Foundation License. It contains no GPL code and may be used in proprietary projects. Copyright © 2001-2026 Python Software Foundation. All rights reserved.

Build docs developers (and LLMs) love