pip with embedded python

Even if explicitly stated that the embeddable version of Python does not support Pip, it is possible with care. You need to:

  1. Download and unzip Python embeddable zip file.

  2. In the file python39._pth or similar, uncomment the import command. Result should look similar to this:

    python39.zip
    .
    import site
    
  3. Download get-pip.py to the Python install folder

  4. Run get-pip.py. this installs Pip into the Scripts directory:

    python get-pip.py
    
  5. Run Pip directly from command line as Pip is a executable program (this example is to install Pandas):

    .\Scripts\pip install pandas
    

You could find more information about this in the Pip issue 4207


how I installed pip into an embeddable python distribution:

  1. unpack the python embeddable distro archive and cd there
  2. run python ./get-pip.py (got here)
  3. EITHER just uncomment string import site inside file pythonXX._pth OR copy folders (at least pip) from the newly-created folder Lib/site-packages/ into pythonXX.zip

now it's possible to python -m pip ...

Tags:

Python

Pip