Coding

Python Embeddable Package on Windows: What It Is and How to Set It Up

The Python embeddable package is a ZIP file containing a minimal, almost fully isolated copy of Python for Windows, meant to ship inside another application. To use it, download the embed ZIP from python.org, extract it to a folder, and run python.exe from that folder. No installer is involved.

This guide covers where to get it, what is and isn't inside, how the ._pth file controls imports, and how to add third-party packages when pip is not available. It is not a replacement for a normal Python install. If you only want to write and run scripts on your own PC, use the regular installer instead (see Python for Windows: how to download and install it).

What the embeddable package is for

The Python documentation describes it as "a ZIP file containing a minimal Python environment" that "is intended for acting as part of another application, rather than being directly accessed by end-users." Typical uses are bundling Python with a desktop program that runs Python scripts, shipping a small tool to machines where you cannot or do not want to install Python system-wide, and loading the interpreter from native code through python3.dll.

When extracted, the distribution is "(almost) fully isolated from the user's system, including environment variables, system registry settings, and installed packages." That isolation is the point: your app behaves the same on every machine, whatever else is installed there.

Where to download it

On the python.org Windows releases page, each release lists embeddable packages for three architectures. As of November 2026, the latest release listed is 3.15.2, with these files:

ArchitectureFile name
64-bit (x86-64)python-3.15.2-embed-amd64.zip
32-bitpython-3.15.2-embed-win32.zip
ARM64python-3.15.2-embed-arm64.zip

The pattern is python-<version>-embed-<arch>.zip. Pick the architecture of the machine that will run it, not the one you build on. The documentation also shows an alternative that uses the Python install manager:

py install 3.15-embed --target=C:\myapp\python

Replace the version and the target folder with your own. Extracting the ZIP by hand (Explorer, or tar -xf in a terminal) gives the same layout.

What is inside, and what is missing

According to the documentation, the standard library is included as pre-compiled, optimized .pyc files in a ZIP, and python3.dll, python315.dll (the number follows the version), python.exe and pythonw.exe are all provided. Three things are not included:

  • Tcl/Tk and everything that depends on it, including Tkinter's GUI backend and IDLE.
  • pip. So pip install does not work out of the box.
  • The Python documentation.

Use python.exe for console programs and pythonw.exe for programs that should not open a console window.

How to run a script with it

Extract the ZIP into an empty folder, for example C:\myapp\python, and put your script next to it. From a terminal:

C:\myapp\python\python.exe C:\myapp\hello.py

The documentation's recommendation for a Python application is the simple route: provide a batch file or generated shortcut that calls python.exe or pythonw.exe with the command-line arguments you need. A launcher executable that calls Py_Main with a hard-coded command line gives a more transparent experience but requires some coding.

How the ._pth file controls imports

The package includes a default file ending in ._pth next to python.exe. The documentation says it "further restricts the default search paths" and "is intended for embedders to modify as necessary." The C API documentation uses python._pth as its example name, and it lists what the file's presence does:

  • sets isolated to 1,
  • sets use_environment to 0, so environment variables such as PYTHONPATH are ignored,
  • sets site_import to 0, so the site module is not imported,
  • sets safe_path to 1,
  • and, since Python 3.15, sets user_site_directory to 0.

The Windows documentation adds that the file lists the directories to include, and that Python ignores the registry and environment variables, and ignores site unless import site is listed. This is the reason a package that works in your normal Python raises ModuleNotFoundError here: nothing outside the listed directories is searched.

Open the file in a text editor to see what your version ships with, since the exact lines differ between releases. Example of the kind of edit you make (example only; keep the lines your own file already has and add to them):

python315.zip
.
site-packages

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

Here site-packages is a folder you created next to python.exe, and the import site line turns the site module back on. Add import site only if you need what site provides, such as .pth file processing. Adding a plain directory line is enough to make that directory importable. Check that an import works after each change; the documentation does not spell out every rule for the file's syntax, so test rather than assume.

How to add third-party packages without pip

The documentation is direct about this: using pip to manage dependencies in the embeddable distribution "is not supported", although "with some care it may be possible to include and use pip for automatic updates." Its guidance is that third-party packages "should be treated as part of the application ('vendoring')", installed by your application's installer alongside the distribution, so you can test against new package versions before shipping updates.

A practical way to do that is to install the packages with a regular Python on your build machine into a folder, then copy the folder next to the embeddable python.exe. pip's --target option installs packages into a directory of your choice:

python -m pip install --target C:\myapp\python\site-packages requests

By default this does not replace existing files in the target folder; add --upgrade to replace packages that are already there. Then list site-packages in the ._pth file as shown above and test with python.exe -c "import requests".

Two cautions. Pure-Python packages are the easy case. Packages with compiled extensions must match the embeddable package's Python version and architecture, so install them with a Python of the same version and bitness as the ZIP you ship. And this copies code, not an environment: it does not create a virtual environment. If you want per-project dependency isolation for development, a venv is the right tool (see Python virtual environments (venv)).

Is ensurepip an option?

The standard python -m ensurepip command bootstraps pip from components bundled inside the standard library, without internet access. The ensurepip documentation does not mention the embeddable distribution, and the Windows documentation lists pip as not included and unsupported there. This guide therefore does not recommend it. If you try it anyway, treat it as unsupported and test it on a copy.

If it still fails

  • ModuleNotFoundError for a package you know exists. The folder is not listed in the ._pth file. Add it, then rerun.
  • No module named 'tkinter' or IDLE missing. Tcl/Tk is not part of the embeddable package. Use a regular Python install for GUI work.
  • Environment variables seem ignored. That is expected while a ._pth file is present. When launching from your own application, the documentation advises clearing or overwriting PYTHONPATH and setting PYTHONHOME before starting python.exe.
  • Wrong architecture. A 32-bit ZIP cannot load 64-bit extension modules, and the reverse. Use matching builds for the interpreter and its packages.

Frequently asked questions

Can I install pip in the Python embeddable package?
The Python documentation says that using pip to manage dependencies in the embeddable distribution is not supported, though with some care it may be possible to include and use pip for automatic updates. The documented approach is to treat third-party packages as part of your application and ship them alongside the distribution.
Does the embeddable package need to be installed?
No. It is a ZIP file. You extract it to any folder and run python.exe from there. Nothing is written to the registry and no installer runs.
Why does import fail for packages I installed in my normal Python?
Because the embeddable distribution is almost fully isolated from the system, including environment variables, registry settings and installed packages. Its ._pth file restricts the search paths, so packages from another Python installation are not visible.
Does the embeddable package include Tkinter or IDLE?
No. The Python documentation states that Tcl/Tk, including everything that depends on it such as IDLE, pip and the Python documentation, are not included.

Sources