Reputation: 925
I followed the link @https://linuxize.com/post/how-to-install-pip-on-centos-7/#2-install-pip to install pip ,however its intalled for python 2.6 that comes with the system,how do I install it for python 2.7?
sudo yum install epel-release
Loaded plugins: security
Setting up Install Process
Package epel-release-6-8.noarch already installed and latest version
Nothing to do
Installing pip
sudo yum install python-pip
Loaded plugins: security
Setting up Install Process
Package python-pip-7.1.0-1.el6.noarch already installed and latest version
Nothing to do
pip version
pip --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)
Machine configuration:
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: OracleServer
Description: Oracle Linux Server release 6.6
Release: 6.6
Codename: n/a
/usr/local
Upvotes: 7
Views: 59817
Reputation: 1
You can install pip
for python 2.7 by running the followings on you terminal:
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
python2 -m ensurepip --default-pip
python2 -m pip install --upgrade pip setuptools
python2 -m pip install termcolor # (termcolor is the module I want to install for python2)
Upvotes: 0
Reputation: 777
In newer versions of Ubuntu such as 20.04, python-pip is no longer a package. Therefore, the old:
sudo apt install python-pip
Will fail.
Here's how to work around this issue:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python get-pip.py
Link: https://www.how2shout.com/linux/how-to-install-python-2-7-on-ubuntu-20-04-lts-linux/
Upvotes: 2
Reputation: 51
pip has dropped a support to python 2.7. If you still want to use it for python 2.7, downgrading the pip will help you:
sudo easy_install pip==20.3.4
Upvotes: 1
Reputation: 506
Try installing manually:
wget -P ~/.local/lib https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2.7 ~/.local/lib/get-pip.py --user
#if using bash
printf "\nPATH=\$PATH:~/.local/bin/" >> ~/.bashrc
source ~/.bashrc
Upvotes: 25
Reputation: 79
Just go into terminal and type in:
sudo apt-get install python-pip
I know that this at least works on a raspberry pi.
Upvotes: -3