Error after upgrading pip: cannot import name 'main'

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

    You must have inadvertently upgraded your system pip (probably through something like sudo pip install pip --upgrade)

    pip 10.x adjusts where its internals are situated. The pip3 command you're seeing is one provided by your package maintainer (presumably debian based here?) and is not a file managed by pip.

    You can read more about this on pip's issue tracker

    You'll probably want to not upgrade your system pip and instead use a virtualenv.

    To recover the pip3 binary you'll need to sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall.

    If you want to continue in "unsupported territory" (upgrading a system package outside of the system package manager), you can probably get away with python3 -m pip ... instead of pip3.

提交回复
热议问题