avatarLiu Zuo Lin

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1139

Abstract

As such, we can use Python’s <i>-m </i>flag as a workaround to execute pip through Python.</p><div id="97dd"><pre><span class="hljs-comment"># some Windows computers</span> python -m pip <span class="hljs-keyword">install</span> something</pre></div><div id="8d15"><pre><span class="hljs-comment"># other Windows computers</span> py -m pip <span class="hljs-keyword">install</span> something</pre></div><div id="4a03"><pre><span class="hljs-comment"># MacOS </span> python3 -m pip <span class="hljs-keyword">install</span> something</pre></div><h1 id="deb8">Installing pip using get-pip.py</h1><p id="130d">If the method above does not work, your Python installation probably doesn’t have pip installed. Here’s a workaround — download the Python script from the link below</p><p id="337f">The link: <a href="https://bootstrap.pypa.io/get-pip.py">https://bootstrap.pypa.io/get-pip.py</a></p><p id="435d">After downloading the script, run the script.</p><div id="020e"><pre><span class="hljs-keyword">python</span> <span class="hljs-built_in">get</span>-pip.<span class="hljs-keyword">py</span></pre></div><p id="d6f7">Something like this sh

Options

ould appear:</p><figure id="2809"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*dImPa0kcY9Ai-Erm2lZlBg.png"><figcaption></figcaption></figure><h1 id="6820">Verifying your Pip installation</h1><p id="20b1">Type the following into your command prompt or terminal.</p><div id="d1fa"><pre><span class="hljs-meta"># Windows</span> pip</pre></div><div id="8ec4"><pre><span class="hljs-meta"># MacOS</span> pip3</pre></div><figure id="3576"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*xP8mn3ofe4aHCRAidYMP6Q.png"><figcaption></figcaption></figure><p id="0026">If something like this appears, you’re good to go.</p><h1 id="18d3">Conclusion</h1><p id="32fe">Hope this helped with your pip headache!</p><p id="ca14">If this provided value for you and you wish to support me as a writer, do consider signing up for a Medium membership! It’s $5 a month, and you get unlimited access to stories on Medium. If you sign up using my link, I’ll earn a small commission.</p><p id="62bf"><a href="https://zl-liu.medium.com/membership"><b>Here’s the link to read unlimited access to Medium</b></a></p></article></body>

What To Do When Pip Install Fails You

It happens. We might be migrating to a new computer, reinstalling Python for whatever reason and so on, and wish to install our favourite Python libraries, and pip just doesn’t work.

I’ve not faced this problem myself, but as a Python tutor, I’ve spent more time solving this problem for new students that I would have liked to. Life is too short to be spend a disproportionate amount of time debugging this, so to save our collective time, here’s a bunch of workarounds for this issue!

Using Python’s -m flag

python -m pip install something

One potential reason why Pip isn’t working could be that Python is in your PATH, but not Pip for some reason. As such, we can use Python’s -m flag as a workaround to execute pip through Python.

# some Windows computers
python -m pip install something
# other Windows computers
py -m pip install something
# MacOS 
python3 -m pip install something

Installing pip using get-pip.py

If the method above does not work, your Python installation probably doesn’t have pip installed. Here’s a workaround — download the Python script from the link below

The link: https://bootstrap.pypa.io/get-pip.py

After downloading the script, run the script.

python get-pip.py

Something like this should appear:

Verifying your Pip installation

Type the following into your command prompt or terminal.

# Windows
pip
# MacOS
pip3

If something like this appears, you’re good to go.

Conclusion

Hope this helped with your pip headache!

If this provided value for you and you wish to support me as a writer, do consider signing up for a Medium membership! It’s $5 a month, and you get unlimited access to stories on Medium. If you sign up using my link, I’ll earn a small commission.

Here’s the link to read unlimited access to Medium

Python
Pip
Recommended from ReadMedium