Any trick to make -pip.py install a specific pip version?
I'm not sure how you are using your script, but you should be able to do something like:
python get-pip.py && pip install -I pip==1.5.6
You may need to add sudo
to both commands.
https://pip.pypa.io/en/latest/reference/pip_install.html#cmdoption-I
source to share
This is a relatively old question, but today I found that recent versions get-pip.py
allow an argument to be passed, for example pip<6
, to ensure that the installed protocol version is <6:
[Nautilus@Nautilus scripts]$ python get-pip.py 'pip<6'
Collecting pip<6
Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB)
100% |████████████████████████████████| 1.0MB 608kB/s
Installing collected packages: pip
Successfully installed pip-1.5.6
This seems to work with any form of argument you could pass to pip itself, eg. >, <, <=,> = and ==
source to share
As I tried to explain in the comments, get-pip.py
as a bootstrap method for pip
. The problem it solves is what you need to pip
install pip
.
The script doesn't let the user choose the version pip
you get, it downloads the latest version automatically.
You can adapt your script and change
def bootstrap(tmpdir=None):
# Import pip so we can use it to install pip and maybe setuptools too
import pip
# We always want to install pip
packages = ["pip"]
to
def bootstrap(tmpdir=None):
# Import pip so we can use it to install pip and maybe setuptools too
import pip
# We always want to install pip
packages = ["pip==1.5.6"]
Now the script should always install pip-1.5.6
instead of the latest version found on pypi
.
source to share