Installation Options
Unix/Linux
Build from source with configure and make
macOS
Download installer or build with Xcode
Windows
Visual Studio build or pre-built installer
Building from Source (Unix/Linux/macOS)
Building CPython from source gives you full control over features and optimizations.Prerequisites
- Ubuntu/Debian
- Fedora/RHEL/CentOS
- macOS
For detailed platform-specific dependencies, see the Developer’s Guide.
Standard Build
Test
Run the test suite to verify the build:
Some tests may be skipped due to missing optional dependencies. This is normal.
Build Configuration Options
Theconfigure script accepts many options to customize your build:
Optimized Build (PGO + LTO)
For maximum performance, use Profile-Guided Optimization (PGO) and Link-Time Optimization (LTO):Alternative Install (Multiple Versions)
To install alongside existing Python versions without overwriting:python3.15 instead of python3, allowing multiple versions to coexist.
For example, you can have
python3.14, python3.15, and python3 (symlink to default) all installed simultaneously.Out-of-Tree Build
Build in a separate directory to keep source tree clean:Building on macOS
macOS builds require special considerations for framework builds and universal binaries.Standard macOS Build
Framework Build
For native macOS app integration:Framework builds integrate better with macOS applications and IDEs but are not required for command-line use.
Universal Binary (Apple Silicon)
To build for both Intel and Apple Silicon:Building on Windows
Windows builds use Microsoft Visual Studio or Clang.Prerequisites
Install Visual Studio
Install Visual Studio 2017 or later with:
- Python workload
- Python native development component
Visual Studio Build
Build
Run the build script from This builds 64-bit Release configuration by default.
PCbuild directory:Build Options
Profile-Guided Optimization (Windows)
For maximum performance on Windows:- PGInstrument build - Creates instrumented binaries
- Runs training workload
- PGUpdate build - Creates optimized binaries using profile data
PGO requires Premium Edition of Visual Studio. Community Edition also works for most scenarios.
Using Clang on Windows
To build with Clang/LLVM:Building Installer
To create Windows installer packages:Post-Installation
Verify Installation
Set Up Environment
Add Python to your PATH (if not already done):Install pip and setuptools
If pip is not included, bootstrap it:Platform-Specific Notes
Linux Distributions
Ubuntu/Debian
Ubuntu/Debian
Fedora/RHEL/CentOS
Fedora/RHEL/CentOS
Arch Linux
Arch Linux
FreeBSD and OpenBSD
Custom OpenSSL
To use a custom OpenSSL installation:Patch releases of OpenSSL have backward-compatible ABI. You can update OpenSSL without recompiling Python.
Troubleshooting
Common Build Issues
Missing Dependencies
Missing Dependencies
Error:
configure: error: no acceptable C compiler foundSolution: Install build tools:OpenSSL Issues
OpenSSL Issues
Error:
Could not build the ssl moduleSolution: Install OpenSSL development files:Test Failures
Test Failures
Error: Some tests fail during
make testSolution:- Check if only optional feature tests are failing
- Review test output for actual errors vs. skipped tests
- File a bug report if genuine test failures occur
Permission Denied
Permission Denied
Error:
Permission denied during make installSolution: Either use sudo or install to user directory:Out of Memory
Out of Memory
Error: Compilation fails with memory errorsSolution: Reduce parallel jobs:
Clean Build
If you encounter persistent issues, try a clean build:Windows-Specific Issues
Visual Studio Not Found
Visual Studio Not Found
Run the build from “Developer Command Prompt for VS” or ensure Visual Studio is properly installed with C++ tools.
Python Not Found
Python Not Found
Install Python 3.10+ or let build.bat download Python via NuGet automatically.
Performance Tuning
Recommended Build Flags
For production deployment:Memory Allocator
For better memory performance:Next Steps
Quick Start
Start writing Python code immediately
Python Tutorial
Learn Python language fundamentals
Developer Guide
Contributing to CPython development
C API Reference
Extend Python with C/C++
Additional Resources
- Build Dependencies: devguide.python.org/setup-building
- Mac Build Instructions: Mac/README.rst
- Windows Build Instructions: PCbuild/readme.txt
- Source Downloads: python.org/downloads/source
- GitHub Repository: github.com/python/cpython
