pip: no module named _internal

前端 未结 26 2002
梦谈多话
梦谈多话 2020-12-02 12:08

I have a problem when I try to use pip in any way. I\'m using Ubuntu 16.04.4

I should say that I\'ve used it already, and I never had any problem, but starting today

相关标签:
26条回答
  • 2020-12-02 12:27

    I fixed this problem by

    sudo apt-get install python3-pip
    

    this worked even for python2.7, amazing...

    0 讨论(0)
  • 2020-12-02 12:29

    An answer from askUbuntu works.

    For pip2.7, you can at first curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py, then python2.7 get-pip.py --force-reinstall to reinstall pip.

    Problem solved. Also works for python3.

    0 讨论(0)
  • 2020-12-02 12:29

    Its probably due to a version conflict, try to run this, it will remove the older pip somehow.

    sudo apt remove python pip
    
    0 讨论(0)
  • My solution is adding import pip to the script linked to the pip/pip3 commands.

    Firstly, open the file (e.g. /usr/local/bin/pip) with your favorite text editor and the sudo mode. For example, I use sudo vim /usr/local/bin/pip to open the script file.

    You will obtain some file as following:

    import re
    import sys
    
    from pip._internal import main
    
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
        sys.exit(main())
    

    Afterwards, insert the statement import pip just before the from pip._internal import main then the issue is resolved.

    0 讨论(0)
  • 2020-12-02 12:32

    I have fixed this error by running the following commands:

    sudo apt remove python-pip
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py
    

    It will remove the previously installed pip and reinstall it. Thanks :)

    0 讨论(0)
  • 2020-12-02 12:34

    Are you using python2 or python3? The following command could be different!

    1. use python3 -m pip --version to see if you have pip installed.
    2. if yes, run python3 -m pip install --upgrade pip.
    3. if no, run sudo apt-get install python3-pip, and do it again.
    0 讨论(0)
提交回复
热议问题