pip: no module named _internal

2020-01-30 03:55发布

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 when I use any command I always get the same error (as an example using pip --upgrade).

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal

I have tried doing sudo apt-get remove python-pip followed by sudo apt-get install python-pip but nothing changed.

Thank you for your time!

标签: python pip
24条回答
走好不送
2楼-- · 2020-01-30 04:49

This solution works for me:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall

or use sudo for elevated permissions (sudo python3 get-pip.py --force-reinstall).

Of course, you can also use python instead of python3 ;)

Source

查看更多
劫难
3楼-- · 2020-01-30 04:50

These often comes from using pip to "update" system installed pip, and/or having multiple pip installs under user. My solution was to clean out the multiple installed pips under user, reinstall pip repo, then "pip install --user pip" as above.

See: https://github.com/pypa/pip/issues/5599 for an official complete discussion and fixes for the problem.

查看更多
爷的心禁止访问
4楼-- · 2020-01-30 04:53

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

sudo apt remove python pip
查看更多
不美不萌又怎样
5楼-- · 2020-01-30 04:57

Nothing worked for me, but only one thing: I used sudo in front of the command and it is working fine.

查看更多
劳资没心,怎么记你
6楼-- · 2020-01-30 04:57

This command works for me.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py --force-reinstall --user

查看更多
Anthone
7楼-- · 2020-01-30 04:59

This did it for me:

python -m pip install --upgrade pip

Environment: OSX && Python installed via brew

查看更多
登录 后发表回答