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!
i tried the followed command to solve the issue and it worked for me curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3 get-pip.py --force-reinstall
Are you using python2 or python3? The following command could be different!
python3 -m pip --version
to see if you have pip installed.python3 -m pip install --upgrade pip
.sudo apt-get install python3-pip
, and do it again.Refer to this issue list
works for me under Mac OS
For
python3
, may trysudo easy_install-3.x pip
depends on the python 3.x version. Orpython3 -m pip install --user --upgrade pip
you can remove it first, and install again ,it will be ok. for centos:
For the current user only:
easy_install --user pip
or
python -m pip install --upgrade --user pip
The second may give
/usr/bin/python: No module named pip
Even ifwhich pip
finds the module named pip. In this case try theeasy_install
My solution is adding
import pip
to the script linked to thepip/pip3
commands.Firstly, open the file (e.g.
/usr/local/bin/pip
) with your favorite text editor and the sudo mode. For example, I usesudo vim /usr/local/bin/pip
to open the script file.You will obtain some file as following:
Afterwards, insert the statement
import pip
just before thefrom pip._internal import main
then the issue is resolved.