I’m struggling to install the python pip module on my centOS server which is running on python2.6.6(centOS 6) or python 2.7.5(CentOS7). Due to some reasons I’m not able to upgrade the python version to 3 or later. So in the case, how can I install a legacy PIP version line pip 20 with my python2.6 or python 2.7 platform?
Thanks.
2
Answers
If you have Python 2, you most likely have pip. Try
python2 -m pip install foobar
.Turns out that in CentOS7
pip
is not available in distro repos by default. You need toyum install epel-release
to enable the EPEL repo, which in turn containspip
:yum install python-pip
.So do this: (as root/using
sudo
)You can use
get-pip.py
for 2.7. Here’s an example in acentos:7
Docker container:Docs: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py. (Though admittedly, they don’t go out of their way to point out the presence of the 2.6/2.7 branches, given that Python 2 is prominently EOL.)