pip3 error - '_NamespacePath' object has no attribute 'sort'

后端 未结 16 1577
生来不讨喜
生来不讨喜 2020-12-07 18:39

I tried to install a package through pip3, and I got this error. Every pip/pip3 command that I run gives me this error-

alexg@hitbox:~$ pip3 -V
Traceback (m         


        
相关标签:
16条回答
  • 2020-12-07 19:19

    I'm using virtualenv and upgrading setuptools didn't work for me. What did work was this workaround:

    pip uninstall setuptools -y && pip install setuptools
    
    0 讨论(0)
  • 2020-12-07 19:19

    After trying all kinds of methods, such as reinstall pip, setuptools, and still can't fix the problem. I follow the instruction of https://github.com/pypa/pip/issues/4216#issuecomment-286348680 and only with an external warning. After that, I use pip to uninstall matplotlib. Finally, all things seem okay.

    0 讨论(0)
  • 2020-12-07 19:21

    I fixed this with follows:

    $curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    

    For python2:

    $python get-pip.py
    

    For python3:

    $python3 get-pip.py
    

    Now it works for me.

    0 讨论(0)
  • 2020-12-07 19:24

    This probably means that your dependencies got messed up.

    Try to uninstall pip3 from scratch and it should work.

    In case it doesn't work, delete your pip installation. In your case:

    rm -r /home/alexg/.local/lib/python3.5/site-packages/pip/
    

    And to be sure next time, best to work with virtual environments :)

    0 讨论(0)
  • 2020-12-07 19:27

    None of the other posted answered worked for me, but running the follow command solved t:

    sudo apt-get purge --auto-remove python3-pkg-resources python3-setuptools

    0 讨论(0)
  • 2020-12-07 19:28

    Yet another answer, but following is the one which eventually fixed the issue for me. Since pip was compromised I was unable to use it for upgrading itself or setuptools and also using easy_install was bringing up the same issue. So I tried to install pip using Python.

    The answer:

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python get-pip.py 
    pip install --upgrade setuptools
    
    0 讨论(0)
提交回复
热议问题