ยง2023-07-20
These instructions cover how to get a working copy of the source code and a compiled version of the CPython interpreter (CPython is the version of Python available from https://www.python.org/). It also gives an overview of the directory structure of the CPython source code.
- Get the source code
The CPython repo is hosted on GitHub. To get a copy of the source code you should fork the Python repository on GitHub, create a local clone of your personal fork, and configure the remotes.
You will only need to execute these steps once per machine:
- Go to https://github.com/python/cpython.
- Press Fork on the top right.(you must sign in)
- When asked where to fork the repository, choose to fork it to your username.
- Your fork will be created at https://github.com//cpython.
- Clone your GitHub fork (replace with your username):
- git clone
% pwd
/Users/alexlai/build
% git clone https://github.com/sousukerai/cpython.git
- Add an upstream remote, then configure git to pull main from upstream and always push to origin:
% cd cpython
% git remote add upstream https://github.com/python/cpython
% git config --local branch.main.remote upstream
% git remote set-url --push upstream git@github.com:sousukerai/cpython.git
- Verify that your setup is correct:
% git remote -v
origin https://github.com/sousukerai/cpython.git (fetch)
origin https://github.com/sousukerai/cpython.git (push)
upstream https://github.com/python/cpython (fetch)
upstream git@github.com:sousukerai/cpython.git (push)
% git config branch.main.remote
upstream
- Configure
./configure --with-pydebug
- make ir
- 2023-07-20
- OrangePi5 plus, 8G mem, 256G PCIeSSD
$ time make -j 10
real 0m46.584s
user 3m53.111s
sys 0m19.067s
$ ./python --version
Python 3.12.0a2+
$ ./python -m venv ~/PYTHON-3.12.0a2+