Error after upgrading pip: cannot import name 'main'

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

    I use sudo apt remove python3-pip then pip works.

     ~ sudo pip install pip --upgrade
    [sudo] password for sen: 
    Traceback (most recent call last):
      File "/usr/bin/pip", line 9, in 
        from pip import main
    ImportError: cannot import name 'main'
    ➜  ~ sudo apt remove python3-pip   
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      libexpat1-dev libpython3-dev libpython3.5-dev python-pip-whl python3-dev python3-wheel
      python3.5-dev
    Use 'sudo apt autoremove' to remove them.
    The following packages will be REMOVED:
      python3-pip
    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
    After this operation, 569 kB disk space will be freed.
    Do you want to continue? [Y/n] y
    (Reading database ... 215769 files and directories currently installed.)
    Removing python3-pip (8.1.1-2ubuntu0.4) ...
    Processing triggers for man-db (2.7.5-1) ...
    ➜  ~ pip
    
    Usage:   
      pip  [options]
    

提交回复
热议问题