Installing pip from the Windows archive

I want to package python and all the dependencies of my code into one distribution. I downloaded the archive with python, wrote the path to it in my scripts, it works. I can't figure out how to install other modules. If I download them and try to run them, I get the error

Traceback (most recent call last):
  File "./packages/setuptools-51.1/setuptools-51.1.0/setup.py", line 7, in <module>
    import setuptools
ModuleNotFoundError: No module named 'setuptools'

The script I run:

#! ./python-3.6.5-embed-amd64/python.exe
from subprocess import call
call(["python", "./packages/setuptools-51.1/setuptools-51.1.0/setup.py"])

But to put the same setuptools you need setuptools.

How else can I install pip or setuptools from a local directory?

 0
Author: drkwdck, 2020-12-27

1 answers

As I understand it, you are using an embedded archive. To install pip in python37._pth (instead of 37, your version), uncomment the line

import site

Next, download the pip installer: https://bootstrap.pypa.io/get-pip.py and drop it in the folder to python.exe.

Go to the folder with embedded Python and install pip:

python.exe get-pip.py

Checking the performance of

Scripts\pip.exe -V

The path to pip in this case is relative python.exe. In general, you will always need to specify the path to pip.exe.

 0
Author: Kers, 2020-12-27 18:38:24