Question
I want to install pip on Windows. Since pip is often described as a replacement for easy_install, should I install pip using easy_install, or is there a better and more standard way to set it up on Windows?
Short Answer
By the end of this page, you will understand what pip is, how it relates to easy_install, and the recommended ways to get pip working on Windows. You will also learn how to verify the installation, use basic pip commands, and avoid common setup problems such as PATH issues or using the wrong Python interpreter.
Concept
pip is Python’s standard package installer. It is the tool most Python developers use to install third-party libraries such as requests, flask, or numpy.
Older Python workflows sometimes used easy_install, which came from setuptools. Over time, pip became the preferred and standard tool because it is better at dependency handling, uninstalling packages, and working with modern Python packaging.
On Windows, the best way to get pip usually depends on how Python was installed:
- If you install Python from the official Python installer,
pipis normally included automatically. - If
pipis missing, you can often install or restore it using Python itself, usually withensurepip. - Using
easy_installto installpipis generally not the preferred modern approach unless you are dealing with an older Python setup.
Why this matters in real programming:
- Most Python tutorials assume
pipis available. - Project dependencies are commonly installed from a file using .
Mental Model
Think of Python as a smartphone, and packages as apps.
- Python is the phone.
- Packages are the apps you want to add.
pipis the app store installer.easy_installis an older installer from an earlier era.
If your phone already comes with the app store, you should use that. If the app store is missing, you restore it using the phone’s built-in tools. You would not normally install the modern app store using an outdated installer unless you were repairing a very old device.
That is how pip and easy_install differ in practice.
Syntax and Examples
The most important commands on Windows are these:
python --version
python -m pip --version
python -m pip install requests
If your system uses the Python launcher, you may also see:
py --version
py -m pip --version
py -m pip install requests
Why use python -m pip?
This tells a specific Python installation to run its own copy of pip. That helps avoid confusion when multiple Python versions are installed.
Example: check whether pip is available
py -m pip --version
Example output:
pip 24.0 from C:\Python311\Lib\site-packages\pip (python 3.11)
This means:
pipis installed- it belongs to Python 3.11
- Python knows where the package files are stored
Example: install a package
py -m pip install requests
This downloads and installs the requests package for the Python interpreter launched by py.
Step by Step Execution
Consider this Windows command:
py -m pip install requests
Here is what happens step by step:
-
pystarts the Python launcher- Windows looks for the Python launcher.
- The launcher chooses a Python installation, often the latest installed version.
-
-m piprunspipas a Python module- Instead of searching for a separate
pip.exe, Python runs thepipmodule directly. - This is more reliable when several Python versions exist.
- Instead of searching for a separate
-
install requeststellspipwhat to dopipreads the commandinstall.- It sees that the package name is
requests.
-
pipresolves dependencies- It checks whether
requestsneeds other packages.
- It checks whether
Real World Use Cases
pip is used in many everyday Python tasks on Windows:
-
Installing libraries for scripts
- Example: install
requeststo call a web API.
- Example: install
-
Starting web projects
- Example: install
flaskordjangoto build a web application.
- Example: install
-
Working with data
- Example: install
pandasormatplotlibfor analysis and charts.
- Example: install
-
Running test tools
- Example: install
pytestfor automated testing.
- Example: install
-
Setting up project dependencies
- Example:
py -m pip install -r requirements.txt
- Managing isolated environments
- Example: create a virtual environment for one project so package versions do not conflict with another.
In real apps, pip is usually one of the first tools you use after installing Python.
Real Codebase Usage
In real projects, developers do not just run pip install randomly. They use pip in repeatable, controlled ways.
Common patterns
- Install from a requirements file
py -m pip install -r requirements.txt
This makes project setup consistent across team members and CI systems.
- Use virtual environments
py -m venv .venv
.venv\Scripts\activate
python -m pip install -r requirements.txt
This keeps project dependencies isolated.
- Verify the active interpreter
python --version
python -m pip --version
This helps prevent installing packages into the wrong Python.
- Upgrade packaging tools when needed
python -m pip install --upgrade pip setuptools wheel
This is common when build or install issues appear.
- Use guard-style checks in setup docs or scripts
Examples in project setup instructions often say:
python -m pip --version
before any install command, so users confirm that is available first.
Common Mistakes
1. Using pip directly when multiple Python versions are installed
Broken approach:
pip install requests
This may install into a different Python than the one your project uses.
Better:
py -m pip install requests
or:
python -m pip install requests
2. Assuming pip must be installed with easy_install
Older advice may suggest this, but on modern Windows setups it is usually unnecessary.
Prefer:
py -m ensurepip --upgrade
or reinstall Python with pip included.
3. Confusing pip not found with Python not found
If this fails:
pip --version
it does not always mean pip is absent. It may simply not be on PATH.
Check this instead:
Comparisons
| Tool or approach | What it is | Recommended on modern Windows? | Notes |
|---|---|---|---|
pip | Standard Python package installer | Yes | Best default choice |
easy_install | Older installer from setuptools | No, usually not | Largely replaced by pip |
python -m pip | Runs pip through a specific Python interpreter | Yes | Safer when multiple Python versions exist |
pip command alone | Runs whichever pip is on PATH | Sometimes |
Cheat Sheet
Recommended commands on Windows
py --version
py -m pip --version
py -m pip install package_name
py -m pip install -r requirements.txt
py -m ensurepip --upgrade
If py does not work
Try:
python --version
python -m pip --version
Best practice
- Prefer
py -m pip ...orpython -m pip ... - Do not use
easy_installunless you are maintaining an older setup - Use virtual environments for projects
- Verify after installation
Quick setup flow
- Install Python from the official installer
- Make sure
pipis included - Verify with:
py -m pip --version
- Install packages with:
py -m pip install requests
Common fixes
pipnot found: trypy -m pip --version
FAQ
Do I need easy_install to install pip on Windows?
Usually no. Modern Python installations on Windows typically include pip, or you can restore it with ensurepip.
How can I check whether pip is already installed?
Run:
py -m pip --version
If that prints a version, pip is installed.
What is the safest way to use pip on Windows?
Use:
py -m pip install package_name
This avoids confusion when multiple Python versions are installed.
Why does pip say command not found, but Python works?
pip may not be on PATH, even though Python is installed correctly. Try py -m pip --version instead.
Can I install pip by reinstalling Python?
Yes. In many cases, reinstalling Python from the official installer with enabled is the simplest solution.
Mini Project
Description
Create a small Windows-friendly Python setup checker that confirms Python and pip are available, then installs a package using the recommended command style. This project helps you practice the exact commands developers use when preparing a machine for Python work.
Goal
Verify that pip works on Windows and use it to install and test a real Python package.
Requirements
- Confirm that Python or the Python launcher is available from the command line.
- Check whether
pipis installed for that Python interpreter. - If
pipis available, install therequestspackage. - Verify the package installation by importing it in Python.
- Use
python -m piporpy -m piprather than relying onpipalone.
Keep learning
Related questions
@staticmethod vs @classmethod in Python Explained
Learn the difference between @staticmethod and @classmethod in Python with clear examples, use cases, mistakes, and a mini project.
Catch Multiple Exceptions in One except Block in Python
Learn how to catch multiple exceptions in one Python except block using tuples, with examples, mistakes, and real-world usage.
Convert Bytes to String in Python 3
Learn how to convert bytes to str in Python 3 using decode(), text mode, and proper encodings with practical examples.