Compile CPython on Windows

See also Windows.

Compile CPython 3 on Windows

To build the Python ssl extension:


  • Visual Studio 2015 (for Python 3.6)
  • CPython source code: get it using Mercurial (TortoiseHG on Windows)
  • svn.exe in PATH: install TortoiseSVN, but check the [x] command line tools in the installer
  • ActivePerl: Community Edition, 64-bit


PCbuild\build -p x64 -d -e

See also: PCbuild/readme.txt.

Compile CPython 2.7 on Windows

  • Install Visual Studio 2008: XXX how to get it?
  • Open a Visual Studio 2008 Prompt
  • In this prompt, run VS\9.0\build.bat -e -d -p x64 to build Python 2.7 in debug mode for 64-bit, and install dependencies like OpenSSL sources if needed

Developer mode


Enable all runtime debug checks in strict mode:

PYTHONMALLOC=debug python3.6 -Wd -bb -X faulthandler script.py

CPython infra

Package Index (PyPI)

cpython GitHub project



Python developer mode


Strict developer mode:

PYTHONMALLOC=debug python3.6 -Werror -bb -X faulthandler script.py

Developer mode:

PYTHONMALLOC=debug python3.6 -Wd -b -X faulthandler script.py
  • Show DeprecationWarning and ResourceWarning warnings: python -Wd
  • Show BytesWarning warning: python -b
  • Enable faulthandler to get a Python traceback on segfault and fatal errors: python -X faulthandler
  • Debug hooks on Python memory allocators: PYTHONMALLOC=debug
  • Enable Python assertions (assert) and set __debug__ to True: remove (or just ignore) -O or -OO command line arguments

See also PYTHONASYNCIODEBUG=1 for asyncio.