Fix Python Pip ImportError: cannot import name main – Python Tutorial

By | January 18, 2020

After you have updated python pip, you may get this import error: ImportError: cannot import name main. In this tutorial, we will introduce you how to fix it.

fix pip import error - cannot import name main

Open terminal and enter command below:

sudo gedit /usr/bin/pip

Then change content to:

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

Save this file and open a new terminal to run pip command.

Leave a Reply

Your email address will not be published. Required fields are marked *