I\'ve installed the latest python (2.7.9) bundled with pip and setuptools for windows 32-bit. I\'ve tried reinstalling pip but the problem persists.
Here\'s the erro
On MacOS if you've installed python via Homebrew, change the line in /usr/local/opt/python/libexec/bin/pip
from
from pip.internal import main
to
from pip._internal import main
Or use this one liner: sed -i '' "s/from pip import main/from pip._internal import main/" /usr/local/opt/python/libexec/bin/pip
The issue is caused by the changes in pip version 10 moving internal namespace under main._internal
and the bin script put in place by homebrew still looking it from the old place (where it used to be in version 9). Issue and some discussion https://github.com/pypa/pip/issues/5240
Open your terminal linux.
hash -d pip
A simple solution that works with Ubuntu, but may fix the problem on windows too:
Just call
pip install --upgrade pip
try this
#!/usr/bin/python
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.i
try:
from pip import main
except ImportError:
from pip._internal import main
if __name__ == '__main__':
sys.exit(main())
It works on ubuntu 16.04. Step 1:
sudo gedit /home/user_name/.local/bin/pip
a file opens with the content:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
Change the main
to __main__
as it appears below:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip import __main__
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(__main__._main())
Save the file and close it. And you are done!
For those having similar trouble using pip 10 with PyCharm, download the latest version here