0

I have installed pip by using the following commands:

sudo apt-get update
sudo apt-get install python-pip

Then I tried to check the version of pip installed by using:

pip --version

the output is:

Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: No module named 'pip'

I used type pip command it's output is:

pip is hashed (/usr/bin/pip)

and the commmand hash -d pip doesn't seem to work.

Any help is greatly appreciated. Thanks in advanced.

6
  • Have you tried to make python3 the default python? The package python-pip is for default python 2.7 (package python3-pip will load pip3 for python3) – guiverc Jun 28 '19 at 5:24
  • python 3.5.2 is my default version because when I type python --version it shows python3.5.2 – subham basu roy chowdhury Jun 28 '19 at 5:31
  • and installing python3-pip does not solve it? – marosg Jun 28 '19 at 5:33
  • On Ubuntu the default python should be 2.7 so python --version should report a 2.7.x (it reports "2.7.16" for me). A python3 --version reports 3.7.4 for me; so I think you've corrupted your system somehow by making python 3.x the default for python instead of python 2.7, and this will cause programs/utils that expect python2 to be default to give errors. – guiverc Jun 28 '19 at 5:37
  • yes it has worked. I have used the command sudo apt-get install python3-pip – subham basu roy chowdhury Jun 28 '19 at 5:39
0

With Python3 you need to apt install python3-pip

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.