0

I get an error when I execute python2 -m pip freeze this command. The error message is as below:

/usr/bin/python: cannot import name HashMissing; 'pip' is a package and cannot be directly executed

I had used apt-get remove --purge python python-pip fo removing the python2.

Then, I do these path checking for knowing pip and python command path.

    john@mymachine:~$ whereis python
    python: /usr/bin/python /usr/bin/python3.4m /usr/bin/python3.4 /usr/bin/python2.7 /usr/bin/python2.7-config /usr/lib/python3.4     /usr/lib/python2.7 /etc/python3.4 /etc/python2.7 /usr/local/lib/python3.4 /usr/local/lib/python2.7 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz
    john@mymachine:~$ which -a pip
    /usr/local/bin/pip
    jonh@mymachine:~$ whereis pip
    pip: /usr/local/bin/pip /usr/local/bin/pip3.5 /usr/local/bin/pip2.7 /usr/local/bin/pip3.4
    john@mymachine:~$ which -a python
    /usr/bin/python

Wish some help.

4
  • just use pip freeze Commented Mar 17, 2018 at 12:32
  • Not work. The message is same. Commented Mar 17, 2018 at 12:34
  • according to the post above you've uninstalled pip, have you reinstalled it again? and are you sure the error is "the same" Commented Mar 17, 2018 at 12:38
  • @SamuelMuiruri Yes. Wether I use pip or python -m pip, it show the same error message. Commented Mar 17, 2018 at 12:43

1 Answer 1

0

Don't know the reason. But, I install the pip again.

wget https://bootstrap.pypa.io/get-pip.py and python get-pip.py

The problem is resolved.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.