0
votes

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.

1
just use pip freezeSamuel Muiruri
Not work. The message is same.jefferyear
according to the post above you've uninstalled pip, have you reinstalled it again? and are you sure the error is "the same"Samuel Muiruri
@SamuelMuiruri Yes. Wether I use pip or python -m pip, it show the same error message.jefferyear

1 Answers

0
votes

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.