Error after upgrading pip: cannot import name 'main'

后端 未结 30 1691
清歌不尽
清歌不尽 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:16

    I met the same problem on my Ubuntu 16.04 system. I managed to fix it by re-installing pip with the following command:

    curl https://bootstrap.pypa.io/get-pip.py | sudo python3

    0 讨论(0)
  • 2020-11-22 16:18

    Trick and works too

    sudo -H pip install lxml

    0 讨论(0)
  • 2020-11-22 16:18

    You can try this:

    sudo ln -sf $( type -P pip ) /usr/bin/pip
    
    0 讨论(0)
  • 2020-11-22 16:19

    This Worked for me !

    hash -r pip # or hash -d pip
    

    Now, uninstall the pip installed version and reinstall it using the following commands.

    python -m pip uninstall pip  # sudo
    sudo apt install --reinstall python-pip
    

    If pip is broken, use:

    python -m pip install --force-reinstall pip
    

    Hope it helps!

    0 讨论(0)
  • resolved in one step only.

    I too faced this issue, But this can be resolved simply by 1 command without bothering around and wasting time and i have tried it on multiple systems it's the cleanest solution for this issue. And that's:

    For python3:- sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall.

    By this , you can simply install packages using pip3. to check use pip3 --version.

    For older versions, use : sudo python -m pip uninstall pip && sudo apt install python-pip --reinstall.

    By this, now you can simply install packages using pip. to check use pip --version.

    0 讨论(0)
  • 2020-11-22 16:21

    The commands above didn't work for me but those were very helpful:

    sudo apt purge python3-pip
    sudo rm -rf '/usr/lib/python3/dist-packages/pip'  
    sudo apt install python3-pip
    cd
    cd .local/lib/python3/site-packages
    sudo rm -rf pip*  
    cd
    cd .local/lib/python3.5/site-packages
    sudo rm -rf pip*  
    sudo pip3 install jupyter
    
    0 讨论(0)
提交回复
热议问题