2018.4.24 linux python pip upgrade bug

When using pip to install some python packages, after installing a package, I found that pip prompted that it was time to upgrade:

You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

So in the spirit of OCD, I upgraded pip as he said:

pip install --upgrade pip

After the upgrade, I found that pip could not be used ! will show:

piano@ubuntu:~$ sudo pip install Keras
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

After google Dafa, I found that I also encountered this problem. It is said that it is a debian problem, and there is also this problem under fedora. Some people say that pip cannot be used to upgrade pip itself.
Some of them mentioned a workaround:

hash -d pip

Pro test available.
Original post address: https://github.com/pypa/pip/issues/5221

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324749115&siteId=291194637