Installing pip on windows using command line in windows

Photo of author

By Jackson Taylor

Home » Electronics Topics » Python & OpenCv » Installing pip on windows using command line in windows

pip is the package installer for Python. It downloads libraries from the Python Package Index (PyPI) and installs them with a single command. If you write Python on Windows, you will use it all the time. This guide shows how to install pip on Windows from the command line, check that it works, keep it up to date and fix the most common errors.

The video below walks through the process. The written steps follow it.

Do you already have pip?

Modern versions of Python for Windows include pip, so you may not need to install anything. Open the Command Prompt and run:

python --version
python -m pip --version

The first command shows your Python version. The second shows the pip version and where it is installed. If both print a version number, pip is ready and you can skip to the section on upgrading it.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

To open the Command Prompt, press the Windows key, type cmd and press Enter.

Method 1: Install Python with pip included

This is the simplest way. The official Python installer from python.org installs pip together with Python.

  1. Download the latest Windows installer from the official Python website.
  2. Run the installer. On the first screen, tick Add python.exe to PATH. This lets the command line find Python and pip.
  3. Choose Install Now, or choose Customize installation and make sure the pip option is ticked.
  4. When the installation finishes, close any open Command Prompt windows and open a new one.
  5. Run python -m pip --version to confirm that pip works.

Close and reopen the Command Prompt after installing. A window that was already open will not see the updated PATH.

Method 2: Install pip with ensurepip

If Python is installed but pip is missing, Python’s built-in ensurepip module can add it. Run:

python -m ensurepip --upgrade

This installs pip from the copy bundled with your Python version. It does not need a separate download.

See also
vnc server (view raspberry from your windows)

Method 3: Install pip with get-pip.py

If ensurepip is not available, use the official bootstrap script from the Python Packaging Authority.

  1. Download get-pip.py from https://bootstrap.pypa.io/get-pip.py and save it in a folder, for example your Downloads folder.
  2. Open the Command Prompt and move to that folder with cd, for example cd %USERPROFILE%\Downloads.
  3. Run the script:
python get-pip.py

When it finishes, check the installation with python -m pip --version. Only download the script from the official address above.

Why use python -m pip?

You can often type just pip install package. Writing python -m pip is more reliable on Windows. It runs pip through the exact Python interpreter you called, so the package goes to the Python you expect. This matters when you have more than one Python version installed.

The Python launcher is another option. py -m pip install package works even when Python is not on your PATH, and you can pick a version, for example py -3 -m pip install package.

Upgrade pip and setuptools

It is a good idea to update pip after installing it. Older versions can fail to install some newer packages. This command upgrades both pip and setuptools:

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works
python -m pip install -U pip setuptools

The -U flag is short for --upgrade. If you only want to update pip, use python -m pip install --upgrade pip.

Installing a library using pip

Once pip is working, installing a library takes one line. As an example, to install the yweather package, type the following command in the Windows Command Prompt:

python -m pip install yweather

pip downloads the package and any other packages it depends on, then installs them. Replace yweather with the name of any package you need. Some older packages may no longer work, because the online service they talk to can change or shut down. Check the package page on PyPI if you are unsure.

See also
ANDROID LAND ROVER

Other useful pip commands

  • python -m pip list shows all installed packages.
  • python -m pip show package-name shows details about one package.
  • python -m pip install package-name==1.2.3 installs a specific version. Use the version number you need in place of 1.2.3.
  • python -m pip install -r requirements.txt installs every package listed in a requirements file.
  • python -m pip uninstall package-name removes a package.

Use a virtual environment for projects

Installing every package into your main Python can cause version conflicts between projects. A virtual environment keeps each project’s packages separate:

python -m venv myenv
myenv\Scripts\activate
python -m pip install package-name

After activation, the environment name appears at the start of the command line. Packages you install now stay inside that environment. Run deactivate to leave it.

Common problems and fixes

“pip is not recognized as an internal or external command”

Windows cannot find pip. The usual cause is that Python was not added to PATH during installation. Try python -m pip --version or py -m pip --version first. If those work, use them instead of plain pip. Otherwise, run the Python installer again, choose Modify or reinstall, and tick Add python.exe to PATH.

Typing python opens the Microsoft Store

Windows can include app execution aliases that point python to the Microsoft Store when Python is not installed. Install Python first. If the problem continues, open Settings, search for Manage app execution aliases and turn off the Python entries.

Permission denied or access errors

If pip cannot write to the Python folder, install the package for your user account only:

python -m pip install --user package-name

You can also open the Command Prompt as administrator, but a virtual environment is usually the cleaner fix.

SSL or connection errors

These often come from a firewall, proxy or an out-of-date pip. Check your internet connection, try again on a different network, and upgrade pip if you can. Work or school networks sometimes block PyPI and need a proxy setting from your administrator.

See also
Bidirectional Operation of High Step-Down Converter

Frequently asked questions

Does Python for Windows come with pip?

Yes. Installers from python.org include pip by default in current versions of Python. You can check with python -m pip --version.

How do I check which version of pip I have?

Run python -m pip --version in the Command Prompt. It prints the pip version and the folder it runs from.

What is the difference between pip and python -m pip?

Both run pip. python -m pip makes sure pip belongs to the Python interpreter you call, which avoids confusion when several Python versions are installed.

How do I update pip on Windows?

Run python -m pip install --upgrade pip. To update setuptools at the same time, use python -m pip install -U pip setuptools.

The Ultimate Money-Saving DIY Skill

From power tools and solar banks to your car, batteries are the most expensive part of your gear. Master the step-by-step DIY system to bring dead batteries back to life.

Get the Step-by-Step Guide

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works