How To Upgrade Pip In Mac | Update Pip On Windows and Linux
Pip is a default standard package-manager used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies, which is called the Python Package Index.
Most distributions of Python come with pip preinstalled. Upgrading pip in windows, Mac, or Linux is an important step, and we have to update time to time to get the latest updates.
Python and OS Compatibility
Python pip works with CPython versions 2.7, 3.5, 3.6, 3.7, 3.8, and also PyPy. This meaning is that pip works on the latest patch version of each of these minor versions. Previous patch versions are supported on a best-effort approach.
The pip works on Unix/Linux, macOS, and Windows.
Python in the older version of Mac
Python is the most popular programming language on the earth right now, and beginners and experienced developers alike widely use it.
Modern Mac OS versions come with Python 2.7.x installed (or Python 2.6.1 if an older Mac OS X version), but many Python users may need to update Python in Mac OS to the newer version like Python 3.8.x or newer.
Note that we said install Python 3, not update to Python 3, because how this will work is installing Python 3 while simultaneously maintaining the Python 2 version on the Mac.
This is important because, apparently, some Mac apps rely on Python 2 version, so if you attempt to upgrade the Python 2.x to Python 3.x on Mac OS, you will eventually break some apps, perhaps critical apps.
With that in mind, you should not attempt to upgrade the current preinstalled Python release on the Mac; instead, you will just have the co-installation of Python 3 for full compatibility.
Also, one thing to note that Python 3 and Python 2 can coexist on Mac without any conflict; the usage commands will just be slightly different.
How to Install Python 3.8 using Homebrew on Mac
Installing the updated version of Python 3 is super easy with HomeBrew.
Of course, you will have to install Homebrew on the Mac before you can use the Homebrew method. Still, if you’re interested in messing around with Python, then Homebrew will probably appeal to you anyway.
To install the latest version of Python 3 with Homebrew, type the following command.
brew install python3
Once the updated Python 3 has been installed on your Mac, you can run the following command.
You can check python 2 and python 3’s version simultaneously.
➜ python --version Python 2.7.16 ➜ python3 --version Python 3.6.4
Now, if you already have Python but do not have upgraded pip on your Mac, then see the following steps.
Steps to upgrade Pip in Mac
Mac OS X latest version with Python version 3, then pip is already installed.
Still, If pip is not installed or upgraded in your machine, you can use the following steps one by one.
Type the following command one by one.
$ xcode-select --install # if pip not installed $ sudo easy_install pip # show current pip version $ pip --version # upgrade pip $ sudo pip install --upgrade pip
My current Pip version is the following.
pip --version pip 20.0.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
Upgrading pip on Linux
First, check the version of Python.
Now, if your version is old, then you can upgrade pip on Linux using the following command.
pip install -U pip
The above command will update your pip version.
Upgrading pip on Windows
To upgrade PIP in Windows, you will have to open the Windows Command Prompt(CMD), and then type the command below.
Note that the following way would only work if you already added the Python to your Windows path.
If you have the older version of pip, then you can upgrade pip on windows using the following command.
python -m pip install -U pip
Upgrade Pip on Windows, Mac, or Linux can be easy, but due to multiple versions of Python running on a machine, sometimes it becomes troublesome.
In this tutorial, we have seen how we can upgrade pip and Python on Mac as well as Windows and Linux.