I'm assuming you have internet access, but you don't have a working pip installation.
Download the pip wheel:
wget https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
To find the url of a release in the first place, you can get the index json endpoint. For example:
$ curl -s https://pypi.org/pypi/pip/json | jq ".urls[0].url"
"https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl"
For users not scripting this but just doing once-off, you may prefer to simply download a pip wheel using your browser. In that case, look for the latest release files here: https://pypi.org/project/pip/#files
Now you have a wheel for pip, and some other wheel file you want to install. You can actually "execute" the pip wheel file to install the other wheel file. For example, if you were trying to install setuptools v39.0.1 from bdist, the command would look like this:
$ python pip-10.0.1-py2.py3-none-any.whl/pip install --no-index setuptools-39.0.1-py2.py3-none-any.whl
Processing ./setuptools-39.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-39.0.1
You will now have a working setuptools installation, even with no pip installation.
In case you were wondering, yes you can use the same trick to install pip itself. That command would look like this:
python pip-10.0.1-py2.py3-none-any.whl/pip install --no-index pip-10.0.1-py2.py3-none-any.whl
And now you should have a working pip installation, associated with whichever interpreter this python
executable is pointing at.
It is. Actually .whl files are just zip archives, so you can just extract their content and play with libraries path variable to make it work. Yet it is really bad practice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With