How To Install Python/Pip On Windows

This article will tell you how to install Python and PIP on Windows OS. It will also tell you how to install pip on Windows and how to upgrade pip using the Python command line. Before installing both of them, you should first go to the Python download page to get the Python installer.

1. How To Install Python 3 And PIP.

Double-click the downloaded Python 3 installer, then you will see below installation wizard window. There are two options that you can choose from.

Install Now will install Python with all default configurations. Customize installation will let you configure most installation settings such as install components and target directory etc.

No matter which option you choose, you had better check both the two checkboxes at the bottom of the wizard dialog, especially Add Python 3.7 to PATH checkbox.

This checkbox can add the Python executable folder to the Windows PATH environment variable values automatically ( After Python installation you can find such as C:\Python37\Scripts\;C:\Python37\ in the Windows system PATH environment variable values).

Then you can run the Python command in a terminal directly after the Python installation.

python-3.7-installation-wizard-select-install-method

In this example we choose the second option – Customize installation. Then it will pop up the Optional Features wizard dialog which will let you choose the installed components, I select all checkbox that contains pip, then it will add pip to the PATH environment variable.
python-3.7-custom-installation-optional-features

Click the Next button to go to Advanced Options wizard dialog.  Please select the first five checkboxes at least. The Add Python to environment variables checkbox must be checked, this will add Python 3 to the PATH environment variable.

You can also choose the Python installation target directory in this dialog ( You had better choose a directory in which the directory path does not contain white space and not too long such as C:\Python37).
choose-python-3.7-installation-directory

Then click the Install button, it will install Python/pip on Windows until you see the installation successful dialog.

2. How To Use Python / PIP On Windows.

2.1 How To Use Python On Windows.

Now that Python 3.7 and pip have been installed on Windows OS, we need to verify whether it is installed correctly or not.

Open a dos console window, and run the command python, if you see the below output that means python is installed correctly. The exit() method will quit Python interactive mode.

C:\Users>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD6
4)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

If it shows an error message such as the command python can not be found, this is because the python path ( C:\Python37 ) is not included in the system PATH environment variable, you should add it in the PATH environment variable manually. You can reinstall Python 3.7 and check the Add Python 3.7 to PATH checkbox to resolve the error entirely. Or you can read the article How To Set Windows Environment Variables.

2.2 How To Use PIP On Windows.

PIP is a Python script that can manage Python packages. It can process search, install, update, and uninstall operations to Python packages. To find all useful Python packages, you can go to https://pypi.org/. In this example, pip is saved in C:\Python37\Scripts directory.

Open a dos window and run pip –version then you can see the below output in the console which means pip has been installed correctly.

C:\Users>pip --version
pip 10.0.1 from c:\python37\lib\site-packages\pip (python 3.7)

How to upgrade the pip version.

python -m pip install --upgrade pip

How to downgrade the pip version.

python -m pip install pip==18.1

How to use pip to search install packages.

pip search package-name

pip install package-name

How to get pip command help.

$ pip help

Usage:   
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and
                              CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --no-input                  Disable prompting for input.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with
                              --no-index.
  --no-color                  Suppress colored output.
  --no-python-version-warning
                              Silence deprecation warnings for upcoming unsupported Pythons.
  --use-feature <feature>     Enable new functionality, that may be backward incompatible.
  --use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.

3. How To Install PIP On Windows With Python Command-Line.

If you had installed Python on Windows and you just want to install pip, you can follow the below steps. If you do not install Python at all, please first read section 1.

First, you can open a dos window and run the command python -m ensurepip –default-pip to bootstrap it from the standard Python library.

If you can not run pip after running the above command, you can download the file get-pip.py. Then run the command python get-pip.py in a dos window. This command will install or upgrade both Python setuptools, wheel, and pip.

You can run the command python -m pip install –upgrade pip setuptools wheel to check whether pip, python setuptools, and wheel are up to date or not.

$ python -m pip install --upgrade pip setuptools wheel
Collecting pip
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 73 kB/s 
Collecting setuptools
  Downloading setuptools-51.3.3-py3-none-any.whl (786 kB)
     |████████████████████████████████| 786 kB 34 kB/s 
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
  Attempting uninstall: pip
    Found existing installation: pip 20.2.1
    Uninstalling pip-20.2.1:
      Successfully uninstalled pip-20.2.1
  Attempting uninstall: setuptools
    Found existing installation: setuptools 41.4.0
    Uninstalling setuptools-41.4.0:
      Successfully uninstalled setuptools-41.4.0
  Attempting uninstall: wheel
    Found existing installation: wheel 0.33.6
    Uninstalling wheel-0.33.6:
      Successfully uninstalled wheel-0.33.6
Successfully installed pip-20.3.3 setuptools-51.3.3 wheel-0.36.2

If the above method does not take effect, go to https://pypi.org/project/pip/#files, and download the latest pip zip file on page right side.

Unzip the download file to a local folder, and copy the folder content ( do not copy the folder ) to the Python install directory ( for example C:\Python37).

Open a dos window, go to the python home folder, run the command python setup.py install to install pip.

Add pip to PATH environment variable by adding  C:\Python2x\Scripts to the PATH environment variable.

4. Video Demo For This Article.

You can watch the video of this example article below.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.