Fixing Broken Pip

I’ve got Python 3.8 on my machine, and recently I got a note that my pip version was old. I tried to upgrade PIP recently with this command:

c:\python38\python.exe -m pip install --upgrade pip

This resulted in an error. When I got the error, which I didn’t save, I tried again from an admin console, but got this:

# c:\python38\python.exe -m pip install --upgrade pip
c:\python38\python.exe: No module named pip

That is frustrating. In searching around, I found an issue that a broken upgrade from Windows may cause Pip to get lost. As a result, I need to get pip reinstalled. This post shows how to get this, with a quick curl and python script execution.

Steve@ARISTOTLE C:\Users\Steve
# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1840k  100 1840k    0     0  1840k      0  0:00:01 --:--:--  0:00:01 2103k

Steve@ARISTOTLE C:\Users\Steve
# python get-pip.py
Collecting pip
  Using cached pip-20.2.1-py2.py3-none-any.whl (1.5 MB)
Collecting wheel
  Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, wheel
Successfully installed pip-20.2.1 wheel-0.34.2

Steve@ARISTOTLE C:\Users\Steve
# pip install tweepy

That worked, and allowed me to do what I wanted, which was get the tweepy module.

Now to do a little Python work.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.