Certainly! Installing libraries in an embeddable Python environment (such as the Windows embeddable package) is a bit different from a standard Python installation, because it is designed to be minimal and portable. Here’s a step-by-step guide:
Open a command prompt in your embeddable Python directory.
Run:
code
python.exe get-pip.py
This will install pip in your embeddable environment.
5. Install Packages Using pip
Use the following command to install packages:
code
python.exe -m pip install <package_name>
Example:
code
python.exe -m pip install requests
6. (Optional) Use a Local site-packages Directory
By default, the embeddable Python may not use a site-packages directory.
To enable it, create a file named pythonXX._pth (where XX is your Python version, e.g., python39._pth) in your embeddable directory.
Add a line with ./Lib/site-packages to the file.
This tells Python to look for packages in that directory.
7. Manually Add Packages (Alternative Method)
If you cannot use pip, you can manually copy the package folders into the Lib/site-packages directory.
8. Test Your Installation
Run:
code
python.exe -m pip list
Or try importing your installed package in a script.
Summary Table
Step
Action
1
Download embeddable zip
2
Extract zip
3
Add standard library (optional)
4
Add pip (get-pip.py)
5
Install packages with pip
6
Enable site-packages in .pth file (optional)
7
Manually copy packages (if needed)
8
Test installation
Note:
The embeddable environment is designed for advanced users and may have limitations (e.g., no registry access, no user site-packages by default). For more complex needs, consider using a full Python installation or a virtual environment.
If you need a script or more details for any step, let me know!