Error after upgrading pip: cannot import name 'main'

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

    I also run into this problem when I wanted to upgrade system pip pip3 from 9.0.1 to 19.2.3.

    After running pip3 install --upgrade pip, pip version becomes 19.2.3. But main() has been moved in pip._internal in the latest version, which leaves pip3 broken.

    So in file /usr/bin/pip3, replace line 9: from pip import main with from pip._internal import main. The issue will be fixed, works the same for python2-pip. (Tested on Ubuntu 18.04 distribution)

    According to @Vincent H.'s answer

提交回复
热议问题