Creating a minimal python development environment under Windows

digfish

Samuel Viana

Posted on March 9, 2024

Creating a minimal python development environment under Windows

This article explains how to get a minimal running Python environment under Windows. After exploring several alternatives, like using micromamba script which is based in anaconda, I went on researching to obtain a stripped version of Python to use as a stub for running non compiled code under Windows. Python.org has the embedded Python distribution on Windows (see download page). The 64-bit 3.11.8 version zip distribution is 11 MB (40 MB expanded). If you analyse its contents, you'll se binaries python and pythonw there. What you don't have is the pip executables, which you can add later. So, extract the python-x.y.z-embed-amd64.zip in a directory of your choice. In the extracted files, find the file pythonXy._pth which has the following contents:

pythonxyy.zip
.

# Uncomment to run site.main() automatically
#import site

Uncomment the last line and save the file. Download the script get-pip.py from https://bootstrap.pypa.io/get-pip.py and save it inside the python directory. Open a command line inside the directory and run python get-pip.py. When the execution fininshes, you should now have a running python environment ready to be used. Add the created Scripts directory to the front of your PATH environment variable :

set PATH=%CD%\scripts;%PATH%

to ensure you are running the right pip to install what you need. For example I like to install the pip_search module which provides the deprecated pip search functionality.

💖 💪 🙅 🚩
digfish
Samuel Viana

Posted on March 9, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related