Error after upgrading pip: cannot import name 'main'

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

    you can simply fix the pip and pip3 paths using update-alternatives

    first thing you should check is your current $PATH run echo $PATH and see is you can find /usr/local/bin which is where pip3 and pip usually are

    there is a change your system is looking here /bin/pip and /bin/pip3 so i will say fix the PATH by adding to your ~/.bash_profile file so it persists

    export PATH=$PATH:/usr/local/bin and then check is its fixed with which pip and which pip3

    if not then use update-alternatives to fix it finally

    update-alternatives --install /bin/pip3 pip3 /usr/local/bin/pip3 30
    

    and if you want to point pip to pip3 then

    update-alternatives --install /bin/pip pip /usr/local/bin/pip3 30
    

提交回复
热议问题