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
- Download
python-3.x.x-embed-amd64.zipfrom python.org - Download
get-pip.pyfrom https://bootstrap.pypa.io/get-pip.py
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
- 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
- Run get-pip.py
-
You can observe that
LibandScriptsdirectories are automatically created -
Edit Configuration File
- Find
python3xx.pthorpython3xx._pthfile in thepython-3.x.x-embed-amd64directory (actual filename depends on Python version) - Open the file, find the line
#import site, remove the leading#, change it toimport site
How to Use pip
-
Using Python Module Method
-
Using Executable Method
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
.pycfiles, which cannot be read or edited by humans - Guarantees code editability: All code remains in original
.pyformat, 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