sumit
6/17/2019 - 11:54 AM

cannot import name 'main'

The error can be resolved by modifying the pip file

Check the location of the file:
$ which pip
path -> /usr/bin/pip

Go to that location /usr/bin/pip and open a terminal.
Enter: $ sudo nano pip

You can see:

from pip import main
if __name__ == '__main__':
     sys.exit(main())
Change to:

import sys
from pip import __main__
if __name__ == '__main__':
     sys.exit(__main__._main())
     
then Ctrl + O write the changes and exit.