How to install pip
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 4, 2026
Key Facts
- Pip is included by default in Python 3.4+ and Python 2.7.9+.
- The `get-pip.py` script is the recommended way to install or upgrade pip.
- You can check if pip is installed by running `pip --version` or `python -m pip --version` in your terminal.
- Pip allows you to easily install and manage software packages written in Python.
- Upgrading pip is recommended to ensure compatibility and access to the latest features.
What is Pip?
Pip, which stands for "Pip Installs Packages" (a recursive acronym), is the standard package manager for Python. It allows developers to easily install, upgrade, and uninstall software packages written in Python that are available on the Python Package Index (PyPI). PyPI hosts a vast collection of libraries and tools that extend Python's capabilities, making it a powerful and versatile language for various applications, from web development and data science to automation and machine learning.
Why is Pip Important?
The importance of pip cannot be overstated in the Python ecosystem. Without pip, installing and managing third-party Python libraries would be a manual and cumbersome process. Developers would have to download source code, compile it, and manually manage dependencies, which is prone to errors and time-consuming. Pip automates this entire process, ensuring that the correct versions of packages and their dependencies are installed, leading to more stable and reproducible development environments.
Checking if Pip is Already Installed
Before attempting to install pip, it's a good practice to check if it's already present on your system. Most modern Python installations include pip by default. You can verify its presence by opening your terminal or command prompt and typing one of the following commands:
pip --versionpip3 --version(if you have both Python 2 and 3 installed)python -m pip --versionpython3 -m pip --version
If pip is installed, these commands will output the installed version number. If you receive an error like "command not found" or "'pip' is not recognized," then pip is likely not installed or not accessible in your system's PATH.
Installing Pip on Windows
If pip is not installed, the easiest and recommended method is to use the official `get-pip.py` script. This script is maintained by the Python Packaging Authority (PyPA) and ensures you get the latest stable version of pip.
- Download `get-pip.py`: Go to https://bootstrap.pypa.io/get-pip.py and save the file to a known location on your computer (e.g., your Downloads folder or Desktop).
- Open Command Prompt: Navigate to the directory where you saved `get-pip.py` using the `cd` command. For example, if you saved it to your Desktop, you might type
cd Desktop. - Run the script: Execute the script using your Python interpreter. Type the following command and press Enter:
python get-pip.py
This command will download and install the latest version of pip and its dependencies. After the installation is complete, you should be able to run pip --version to confirm.
Installing Pip on macOS
macOS often comes with Python pre-installed, but pip might not be included in older versions. Similar to Windows, using the `get-pip.py` script is the recommended approach.
- Download `get-pip.py`: Visit https://bootstrap.pypa.io/get-pip.py and save the file.
- Open Terminal: Launch the Terminal application (found in Applications > Utilities).
- Navigate to the directory: Use the `cd` command to go to the folder where you saved `get-pip.py`.
- Run the script: Execute the script using the Python 3 interpreter (which is typically aliased as `python3` on macOS):
python3 get-pip.py
After installation, verify with pip3 --version or python3 -m pip --version.
Installing Pip on Linux (Debian/Ubuntu)
On Debian-based Linux distributions like Ubuntu, pip is often available through the system's package manager (APT). This method is generally preferred as it integrates better with system updates.
- Update package list: Open your terminal and run:
sudo apt update - Install pip for Python 3:
sudo apt install python3-pip - Install pip for Python 2 (if needed):
sudo apt install python-pip
After installation, you can check the version using pip3 --version or pip --version respectively.
Installing Pip on Linux (Fedora/CentOS/RHEL)
For Red Hat-based Linux distributions, you can use the `dnf` or `yum` package manager.
- Install pip for Python 3:
Using
dnf(Fedora 22+):sudo dnf install python3-pipUsing
yum(CentOS/RHEL/Older Fedora):sudo yum install python3-pip - Install pip for Python 2 (if needed):
Using
dnf:sudo dnf install python-pipUsing
yum:sudo yum install python-pip
Verify the installation with pip3 --version or pip --version.
Upgrading Pip
It's crucial to keep pip updated to benefit from new features, security patches, and compatibility improvements. You can upgrade pip using pip itself:
- For Python 3:
python -m pip install --upgrade piporpip3 install --upgrade pip - For Python 2 (if still in use):
python -m pip install --upgrade piporpip install --upgrade pip
Using python -m pip is often recommended as it explicitly uses the pip associated with that specific Python interpreter, avoiding potential conflicts if multiple Python versions are installed.
Troubleshooting Common Issues
'pip' is not recognized: This usually means pip is not installed, or its installation directory is not included in your system's PATH environment variable. Ensure you ran the installation script correctly or installed it via your system's package manager. You might need to restart your terminal or computer after installation.
Permission errors: On Linux and macOS, you might encounter permission errors if you try to install packages globally without sufficient privileges. It's often recommended to use virtual environments to manage project dependencies, or use pip install --user to install packages for the current user only.
Multiple Python versions: If you have multiple Python versions installed, be mindful of which `pip` command you are using. Use `pip3` for Python 3 and `pip` for Python 2 (if applicable), or explicitly use the `python -m pip` or `python3 -m pip` syntax to ensure you are managing packages for the correct Python interpreter.
More How To in Daily Life
Also in Daily Life
More "How To" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Pip (package manager) - WikipediaCC-BY-SA-4.0
- get-pip.py - The Python Packaging Authorityfair-use
- Installing Python Packages - Python 3.12.4 documentationPython Software Foundation License
Missing an answer?
Suggest a question and we'll generate an answer for it.