Python `no module pip.__main__;` error when trying to install a module

后端 未结 4 1320

I am getting the following error on my Raspberry Pi: No module named pip__main__; \'pip\' is a package and cannot be directly executed

When I type in to

4条回答
  •  我在风中等你
    2020-12-11 17:12

    I had the same issue and none of the previous answers solved it for me.

    The error appeared when I uninstalled and reinstalled python to my PC. As it appears the previous existing version of pip wasn't completely removed and when I was trying to import it with python -m pip install package it was actually trying to call the previous version.

    To solve it first manually delete the pip folders in the following locations:

    C:\Users\username\pip
    C:\Users\username\AppData\Local\pip
    C:\Users\username\AppData\Local\Programs\Python\Python**\lib\site-packages\pip***
    C:\Python**\pip
    

    Then download get-pip.py.

    Finally, navigate to the folder where you downloaded it and run:

    python get-pip.py
    

    This procedure should reinstall pip and fix the issue.

提交回复
热议问题