This article describes how to add pip, install custom modules and use an interpreter form the embeddable package via batch files.
- Navigate to https://www.python.org/downloads/
- Scroll to Python releases by version number section and choose Download for a required version
- Select Windows embeddable package for a desired architecture
Download get-pip.py
script via curl:
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Alternativelly, download the script manually (from https://bootstrap.pypa.io/get-pip.py) and copy it to Python folder (check https://pip.pypa.io/en/stable/installation/)
Run the script to download pip binaries and scripts:
python get-pip.py
Open config file pythonXX._pth
and append the fillowing paths to lookup folder list:
Lib
Lib\site-packages
Now it is possible to run pip for installation of required modules to the embeddable directory.
In order to use the configured embedded environment in batch scripts,
create a bat file pythonenv.bat
in the package directory:
set PYTHON_DIR=%~dp0
set PATH=%PYTHON_DIR%;%PYTHON_DIR%/Scripts;%PATH%
Use pythonenv.bat
in a way similar to VsDevCmd.bat
from Visual Studio
call python-embeddable\pythonenv.bat
python -m pyserial
- pip manual installation - https://pip.pypa.io/en/stable/installation/
- Installing pip with embeddable zip Python in Windows - https://roytuts.com/installing-pip-with-embeddable-zip-python-in-windows/
- pip with embedded python - https://stackoverflow.com/a/48906746
- Adding packages to Python "embedded" installation for Windows - https://stackoverflow.com/a/69659472