Error after upgrading pip: cannot import name 'main'

后端 未结 30 2008
清歌不尽
清歌不尽 2020-11-22 15:51

Whenever I am trying to install any package using pip, I am getting this import error:

guru@guru-notebook:~$ pip3 install numpy
Traceback (most recent call l         


        
30条回答
  •  不要未来只要你来
    2020-11-22 16:23

    I'm running on a system where I have sudo apt but no sudo pip. (And no su access.) I got myself into this same situation by following the advice from pip:

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

    None of the other fixes worked for me, because I don't have enough admin privileges. However, a few things stuck with me from reading up on this:

    • I shouldn't have done this. Sure, pip told me to. It lied.
    • Using --user solves a lot of issues by focusing on the user-only directory.

    So, I found this command line to work to revert me back to where I was. If you were using a different version than 8.1.1, you will obviously want to change that part of the line.

    python -m pip install --force-reinstall pip==8.1.1 --user
    

    That's the only thing that worked for me, but it worked perfectly!

提交回复
热议问题