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
I fixed this problem by
sudo apt-get install python3-pip
this worked even for python2.7, amazing...
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.
Its probably due to a version conflict, try to run this, it will remove the older pip somehow.
sudo apt remove python pip
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.
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 :)
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.