Reputation: 41
I am using a MacOS 10.15 and Python version 3.7.7
I wanted to upgrade pip so I ran pip install --upgrade pip
, but it turns out my pip was gone (it shows ImportError: No module named pip
when I want to use pip install ...
)
I tried several methods like python3 -m ensurepip
, but it returns
Looking in links: /var/folders/sc/f0txnv0j71l2mvss7psclh_h0000gn/T/tmpchwk90o3
Requirement already satisfied: setuptools in ./anaconda3/lib/python3.7/site-packages (49.6.0.post20200814)
Requirement already satisfied: pip in ./anaconda3/lib/python3.7/site-packages (20.2.2)
and pip install
still does not work and returns the same error message.
I also tried easy_install pip
and other methods but pip still does not work.
Can anyone help me with this?
Update: Using the method from @cshelly, it works on my computer!
Upvotes: 3
Views: 1433
Reputation: 615
Since it says no module named pip, thus pip is not installed in your system So you may try
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
to download pip directly then you can use execute it using -
python3 get-pip.py
For details you may refer - https://www.geeksforgeeks.org/how-to-install-pip-in-macos/
PS: You may need to use sudo to make use of administrative privileges.
Upvotes: 1
Reputation: 69755
Try the following:
python3 -m pip --upgrade pip
The -m
flag will run a library module as a script.
Upvotes: 3