I’m having a blast building CPython from scratch and thought it’s probably a good idea to keep track of the build steps. I figured this one’s something I’ll be doing/repeating for a long time. This has the potential of making Python app deployment quite simple.
Start by downloading and extracting a copy of compressed Python sources. Here’s one example:
https://www.python.org/ftp/python/3.9.12/Python-3.9.12.tgz
Extract and CD to the folder containing the sources using PowerShell. Then run the following command to build Python:
.\PCbuild\build.bat -e -c Release -p x64 -t Build
Keep in mind, this requires Visual Studio and its C++ development components to be present on your computer.
Add the build folder to the path. (something like C:\Python-3.9.12\PCbuild\amd64)
CD to build folder and run the following:
python -m ensurepip --upgrade
Now you can install pip packages and start using Python. Here’s an example:
python -m pip install jupyterlab
Have fun!