Skip to content

Embedded Python pip Installation Guide for Windows (python-embed)

This article has nothing to do with embedded hardware development.

Supported Operating Systems

This tutorial has been tested successfully on:

  • Windows 11
  • Windows 10
  • Windows Server 2016
  • Windows Server 2012 R2

Version Selection

Python Version Status Notes
3.12, 3.11, 3.10 Working Recommended
3.9, 3.8 May have SSL errors Solutions: switch network or node

Download

Extract: Extract the zip to any directory. Using the compression software's "create folder with filename" feature is recommended, which automatically creates the python-3.x.x-embed-amd64 folder.

Installation Steps

  1. Configure Network Proxy (if needed)

HTTP/Socks Proxy:

Temporarily set proxy environment variables (effective for current session only):

# HTTP proxy
$env:HTTP_PROXY="http://proxy.example.com:8080"
$env:HTTPS_PROXY="http://proxy.example.com:8080"

# Socks proxy
$env:HTTP_PROXY="socks5://proxy.example.com:1080"
$env:HTTPS_PROXY="socks5://proxy.example.com:1080"

Tun Mode Proxy: - Find and enable Tun/Tunnel/virtual network card options in your proxy client - Different clients have different operation methods; refer to their documentation - Usually no additional environment variable configuration is needed after enabling

  1. Run get-pip.py
    Set-Location "PATH TO YOUR LOCATION\python-3.x.x-embed-amd64"
    .\python.exe .\any-path\get-pip.py
    
  2. You can observe that Lib and Scripts directories are automatically created

  3. Edit Configuration File

  4. Find python3xx.pth or python3xx._pth file in the python-3.x.x-embed-amd64 directory (actual filename depends on Python version)
  5. Open the file, find the line #import site, remove the leading #, change it to import site

How to Use pip

  1. Using Python Module Method

    Set-Location "PATH TO YOUR LOCATION\python-3.x.x-embed-amd64"
    .\python.exe -m pip
    

  2. Using Executable Method

    Set-Location "PATH TO YOUR LOCATION\python-3.x.x-embed-amd64"
    .\Scripts\pip.exe
    

Purpose of This Article

This article introduces Chinese users how to use python-embed (embedded Python) on Windows, packaging the Python runtime (interpreter) with Python programs in a folder format. Advantages of this approach:

  • No need to compile to single exe: Avoids executables generated by packaging tools containing .pyc files, which cannot be read or edited by humans
  • Guarantees code editability: All code remains in original .py format, editable and debuggable anytime
  • No Git dependency: User-friendly for users unfamiliar with Git version control
  • Suitable for private projects: Especially suitable for writing non-open-source private projects without dealing with version control complexity
  • Easy to distribute: Can be freely copied and executed between Windows x64 systems, very friendly for "game hosting servers" (low-price NAT VMs providing RDP) sold in mainland China

Notes

  • About dependency management: If you need a more modern dependency management tool, consider uv, but note that uv is more suitable for open-source project development or production environment deployment, which may not fully align with this article's core idea of "easy distribution between different systems"
  • Network requirements: Installing dependencies may require access to overseas servers; configuring a proxy is recommended for better download speeds