File “/usr/bin/pip”, line 9, in from pip import main ImportError: cannot import name main

后端 未结 6 464
轻奢々
轻奢々 2020-12-07 17:58

I am trying to run a webpage using python flask and connecting it with the database of MySQL and while installing MySQL packages I\'m receiving this error.

6条回答
  •  情书的邮戳
    2020-12-07 18:20

    As suggested in pip's github issue

    The temporary fix is -

    Edit your /usr/bin/pip file and comment the line importing main and edit it

    #from pip import main
    from pip._internal import main as main
    

    Worked perfectly for me. Note - this is a temporary fix. Wait for team pip to fix this.

    OR

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

    to this:

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

    As suggested in this SO answer.

提交回复
热议问题