How to Install Python PIP on Windows, Mac, and Linux (2023)

Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

Like any programming language, Python supports third-party libraries and frameworks. You can use these to avoid reinventing the wheel with every new project. If you want to use them, you can find these Python libraries on a central repository called the Python Package Index (PyPI).

It can be a frustrating and time-consuming process to download, install, and manage these packages manually. Instead, many developers rely on a tool called PIP to make the entire procedure simple and error-free. We’ll show you how to install PIP for Python in Windows, Mac, and Linux.

What Is PIP for Python?

PIP is an acronym that stands for “PIP Installs Packages” or “Preferred Installer Program.” It’s a package manager for Python that lets you manage PyPI packages not included with the standard Python distribution. PyPI hosts a large collection of frameworks, tools, and libraries for applications in finance, health, and more.

Is PIP Installed With Python?

If you’re using Python 2.7.9 (or greater), 3.4 (or greater), then PIP is already built into the Python installer. When you download the latest release, you should remember that a particular release isn’t supported indefinitely.

According to Python’s development cycle, support for Python 3.4 ended in March 2019. This means that it has bypassed the end-of-life branch, and you’ll no longer get security fixes. So you’ll end up dealing with more significant changes in both Python and in libraries at the same time, which makes upgrading scary.

(Video) 6 PYTHON How to install PIP LATEST on macbook using terminal

Is Python Correctly Installed?

You should make sure that Python is properly installed on your system. There are different ways to install Python: through a package manager or from the official Python website. While the installation is simple, it helps if you’re aware of the best practices for managing Python or it’s easy to make mistakes.

Install and Manage Python PIP for Windows

By default, the Python installer places its executables in your AppData directory, so it doesn’t need admin permissions. Or you can specify a higher-level target directory (C:\Python3.9) to make it easier to find.

The installation process optionally adds this directory to the system PATH, so you don’t have to configure anything. If you don’t do this during installation, you can add Python to the Windows PATH variable later, manually.

If you’re using Chocolatey to install packages, make sure to avoid mixing that installation with a regular package on the same machine. To check the version of the installed Python, press Win + X and open Command Prompt. Then, type in:

 py --version 

To check the PIP version, type:

(Video) Python Environment Setup for Windows, Mac, Linux (Pip and Venv)

 py -m pip --version 

While PIP doesn’t update often, it’s still important to stay on top of new versions for bug fixes, security fixes, and compatibility. To check for any upgrades, type in:

 py -m pip install --upgrade pip 

If you get a “Python is not defined” message, then something has gone wrong during the installation process.

Install and Manage Python PIP for Mac

On manual installation, Python creates a folder in /Applications and installs its framework in /Library/Frameworks/Python.framework. This includes the Python executable and its libraries. The installer adds a symlink to this location under /usr/local/bin. If you only use Python occasionally, this setup works well.

How to Install Python PIP on Windows, Mac, and Linux (1)

Homebrew for Python Development

If you’re working on multiple Python projects, the default location, which needs sudo privileges, creates hurdles. Many people prefer to use Homebrew to install software packages, but should you use it for Python development? The problem with using Homebrew Python is that it’s not in your control.

Homebrew might upgrade your Python—e.g. 3.8 to 3.9—without your intervention. For example, the "youtube-dl" package uses Python as its dependency, the Python package may get updated as and when needed. You lose control over “site-packages” and all the PIP packages that you had installed might become inaccessible.

Use Pyenv to Manage Python Installation

The Homebrew Python documentation recommends pyenv to manage Python environments. To make pyenv work, install build dependencies through Homebrew. Open Terminal, then type in:

 brew install openssl readline sqlite3 xz zlib 

Next, install pyenv:

 brew install pyenv 

Finally, update the shell profile configuration, i.e ~/.zshrc if your default shell is ZSH. Add the following lines:

 echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

Quit Terminal and restart.

(Video) How To Install PIP In Python On Mac | pip install python

How to Install Python PIP on Windows, Mac, and Linux (2)

If you want to see all the versions of Python that pyenv can install for you, type in:

 pyenv install --list 

To install a specific Python version, type

 pyenv install 3.9.7 

It’ll take a bit of time for installation to get completed. Let’s assume that a project requires 3.8.12, a version that is not installed on the system. Let’s install this version through pyenv

 pyenv install 3.8.12 

You can see what versions of Python you have installed with

 pyenv versions 

“system” version is the one that comes with Mac, i.e., Python 2.7. Since it is deprecated, let’s forget about it. Now tell pyenv the default version you want to use.

How to Install Python PIP on Windows, Mac, and Linux (3)

You can set Python versions at three levels: Global, Local, and Shell. Read the pyenv documentation for more details. To set it globally, type:

 pyenv global 3.9.7 

The global level sets the Python version for all shells and directories. Check what happens when you check the current Python version.

(Video) Install pip using command line on a Mac

 python3 --version 

To check the PIP version, type in:

 python3 -m pip --version 

And if you wish to check for any updates to PIP, type:

 python3 -m pip install --upgrade pip 

The local level changes the Python version only for the current folders and subfolders. So if a project requires Python 3.8.12, type in:

 pyenv local 3.812 

This command configures a specific Python version in the local folder without changing the global one.

Install and Manage Python PIP for Linux

Many Linux distributions come packaged with Python, but it may not be the latest version. To find out which Python version you have, open the Terminal and type in:

 python3 --version 

If you have Python installed on your machine, then one of these commands should respond with a version number. If you want to install the Python distribution on Linux, the built-in package manager is probably the best method.

Advanced Package Tool for Ubuntu or Debian-based Distributions

 sudo apt install python3-pip 

Pacman Package Manager for Arch Linux

 sudo pacman -S python-pip 

Dandified Yum for Fedora-based Distributions

 sudo dnf install python3-pip python3-wheel 

Zypper Package Manager for openSUSE

 sudo zypper install python3-pip python3-setuptools python3-wheel 

Yum Package Manager for CentOS and Red Hat Enterprise Linux

 sudo yum install python3 python3-wheel 

Install and Configure Virtual Environment

Once you have a base installation of a Python setup, don’t start installing packages directly into it with PIP. That’s because every project on your system will use a central site-packages directory to store and retrieve packages. This may often be what you want, but if you have two projects requiring different libraries, it can be a problem.

Since Python stores only one global version of a library, you should create isolated environments for your projects.

Manage Python Packages With PIP

Once your PIP workflow is ready, you can start installing packages from PyPI.

Install

 # Mac
python3 -m pip install "SomeProject"

# Windows
py -m pip install "SomeProject"

Install a Specific Version

 # Mac
python3 -m pip install "SomeProject=1.0"

# Windows:
py -m pip install "SomeProject=1.0"

Upgrade

 # Mac
python3 -m pip install --upgrade "SomeProject"

# Windows
py -m pip install --upgrade "SomeProject"

Uninstall

 # Mac
python3 -m pip uninstall "SomeProject"

# Windows
py -m pip uninstall "SomeProject"

List Installed Packages

 # Mac
python3 -m pip list

# Windows
py -m pip list

List Outdated Packages

 # Mac
python3 -m pip list --outdated

# Windows
py -m pip list --outdated

Learn More About Python

Python is a useful language with applications ranging from web development to data analysis. It’s important to set up Python correctly so that your programming is smooth and error-free.

The best way to learn Python is by building projects. Read our guide on scraping a website with the beautiful soup Python library.

(Video) How To Install Python Pip? | Install Pip On Windows | Python Training | Edureka

FAQs

How install pip Linux and Windows? ›

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.

How to install Python pip in Linux? ›

Installing pip for Python 3
  1. Start by updating the package list using the following command: sudo apt update.
  2. Use the following command to install pip for Python 3: sudo apt install python3-pip. ...
  3. Once the installation is complete, verify the installation by checking the pip version: pip3 --version.
Mar 25, 2020

How do I install Python pip on Mac? ›

To install PIP using ensurepip:

Open the Mac Terminal app via the Launchpad. In the Terminal, type python -m ensurepip or python3 -m ensurepip and press Enter. If PIP is missing, ensurepip will install PIP. Follow any additional on-screen instructions to complete this process.

How do I install Python pip on Windows? ›

How to Install PIP on Windows
  1. Check If Python Is Available. ...
  2. Check If PIP Is Already Installed. ...
  3. Download PIP. ...
  4. Install PIP on Windows. ...
  5. Verify the PIP Installation Process and Check the PIP Version. ...
  6. Add PIP to Windows Environment Variables.
Jun 9, 2022

Is pip for Windows or Linux? ›

The current version of pip works on: Windows, Linux and MacOS. CPython 3.7, 3.8, 3.9, 3.10 and latest PyPy3.

Where is pip install in Linux? ›

Installing pip on Linux

To install pip, go to https://bootstrap.pypa.io/get-pip.py. Save the file if you're prompted to do so; if the code for get-pip.py appears in your browser, copy and paste the entire program into your text editor and save the file as get-pip.py.

How to install pip for Python? ›

Run python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already. Be cautious if you're using a Python install that's managed by your operating system or another package manager.

How to install pip in Linux using yum? ›

Installing Pip for Python 2
  1. Step 1: Update Repositories. If you updated the repositories in the previous section, skip to the next step. ...
  2. Step 2: Install Pip 2. To install Pip2, open the terminal window, enter the command: sudo yum –y install python2-pip. ...
  3. Step 3: Verify the Installation.
Aug 3, 2020

Is pip included in Python install? ›

PIP is automatically installed with Python 2.7. 9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.

Why is pip install not working Mac? ›

Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.

How to install Pip3 on Windows? ›

Add Pip3 to Windows Environment Variables
  1. Open the Control Panel and navigate to System.
  2. Click on Advanced system settings in the upper left panel.
  3. Click on Environment Variables.
  4. Under System Variables, scroll down then double-click the PATH variable.
  5. Click New, and add the directory where pip3 is installed,
Aug 9, 2022

How do I install python on Mac and Windows? ›

Visit https://www.python.org/downloads/windows and download the installer based on your local machine's hardware architecture. The web-based installer needs an active internet connection. So, you can also download the standalone executable installer.

Why is pip not installed with Python? ›

A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python on your computer. To fix it, you will either need to re-install Python and check the box to add Python to your PATH or install pip on your command line.

How do I install both Windows 10 and Linux? ›

Conclusion
  1. check if your PC's BIOS is in UEFI mode.
  2. partition your hard drive.
  3. optimize your hard drive.
  4. make a bootable USB drive.
  5. install Ubuntu Linux Distro along with Windows on your Windows 10 PC.
Aug 24, 2022

Can I use pip install in Windows? ›

You can easily install PIP on Windows by downloading the installation package, opening the command line, and launching the installer. This tutorial will show how to install PIP on Windows, check its version, upgrade, and configure.

How to install pip on Ubuntu for Windows? ›

How to install PIP on Windows? [A Step-by-Step Guide]
  1. Step 1: You need to download PIP get-pip.py. You have to download get-pip.py before installing PIP. ...
  2. Step 2: Open the Windows Command Line. ...
  3. Step 3: Install PIP on Windows. ...
  4. Step 4: Check the PIP version. ...
  5. Step 5: Installation verification. ...
  6. Step 6: How to configure?

How do I install Python and pandas on Windows? ›

Here is the how-to to install Pandas for Windows:
  1. Install Python.
  2. Type in the command “pip install manager”
  3. Once finished, type the following: *pip install pandas* Wait for the downloads to be over and once it is done you will be able to run Pandas inside your Python programs on Windows. Comment. Comment. Comment.
Sep 16, 2020

Videos

1. Python Program to Print Left Pascals Star Triangle #shorts #youtubeshorts #shortsvideo
(Programming Joy Shorts )
2. How to Install Python3: Linux, Mac, PC
(CBT Nuggets)
3. How to install Pip on a Mac | Spar
(SUPERFUSION)
4. Python installation: Windows, Mac and Linux (Kali Linux, Ubuntu) or just run in your browser 😀
(David Bombal Tech)
5. How to Install Python Pip On Ubuntu 18.04 LTS / Ubuntu 20.04 LTS
(ProgrammingKnowledge2)
6. Python Workshop - Installing Packages
(Core Electronics)
Top Articles
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated: 12/13/2022

Views: 6434

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.