0

I got error cannot import name main when i tried to running pip. I had tried modify file /usr/bin/pip to

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())

according to this and i got another error module object has no attribute _main. Thanks in advance.

Shark
  • 23
  • 8
  • How about trying the following on python interpreter? `from pip import __main__; print(dir(__main__))`? – Kota Mori Sep 11 '18 at 05:38
  • @KotaMori Thx.. After restart my computer, the changes have taken effect. I checked it again, and the previous changes were still there, so weird. Seems restart's always right. – Shark Sep 12 '18 at 13:00

1 Answers1

0

Did you try the third answer on that page? The import line which worked for me was:

from pip._internal import main

I left the other lines alone.

Sree
  • 350
  • 1
  • 8