Search code examples
python-2.7pipimporterrorpipenv

In Windows 10, pip import error: cannot import name main after installing pipenv


I am trying to use pipenv as well as pip and having some issues. I installed pipenv using pip. I installed pipenv using pip. Then I went back and tried to run pip -v and got the following: ImportError: cannot import name main. I have seen this question answered for Linux and Mac, but I cannot use sudo or which commands; I am on Windows 10 using the CMD console. In my scripts folder, I see pip, pip2.7, and pip2. I cannot remember which one was my system pip. I know I need to maybe uninstall and reinstall (I have already tried to upgrade, but of course, without pip running you can't upgrade pip). I don't want to make more of a mess, so I wanted to ask how to resolve this in the CMD console on Windows.


Solution

  • Apparently, when I installed pipenv, it changed the system pip version that I was previously using. For some reason, all of the answers I found were using Linux or Mac, but here is how I resolved it. Simply open your command prompt and type:

     $python -m pip uninstall pip
    

    Then, test that you still have your old version installed by typing:

     $pip -V
    

    This showed me that I had gone from using pip version 18 back to using version 8.1.1. You should then be able to proceed to other tasks using pip.