pip freeze

Usage

Unix/macOS

  1. python -m pip freeze [options]

Windows

  1. py -m pip freeze [options]

Description

Output installed packages in requirements format.

packages are listed in a case-insensitive sorted order.

Options

-r``, --requirement <file>

Use the order in the given requirements file and its comments when generating output. This option can be used multiple times.

-f``, --find-links <url>

URL for finding packages, which will be added to the output.

-l``, --local

If in a virtualenv that has global access, do not output globally-installed packages.

--user

Only output packages installed in user-site.

--path <path>

Restrict to the specified installation path for listing packages (can be used multiple times).

--all

Do not skip these packages in the output: distribute, pip, setuptools, wheel

--exclude-editable

Exclude editable package from output.

--exclude <package>

Exclude specified package from the output

Examples

  1. Generate output suitable for a requirements file.

    Unix/macOS

    1. $ python -m pip freeze
    2. docutils==0.11
    3. Jinja2==2.7.2
    4. MarkupSafe==0.19
    5. Pygments==1.6
    6. Sphinx==1.2.2

    Windows

    1. C:\> py -m pip freeze
    2. docutils==0.11
    3. Jinja2==2.7.2
    4. MarkupSafe==0.19
    5. Pygments==1.6
    6. Sphinx==1.2.2
  2. Generate a requirements file and then install from it in another environment.

    Unix/macOS

    1. env1/bin/python -m pip freeze > requirements.txt
    2. env2/bin/python -m pip install -r requirements.txt

    Windows

    1. env1\bin\python -m pip freeze > requirements.txt
    2. env2\bin\python -m pip install -r requirements.txt

Important

Did this article help?

We are currently doing research to improve pip’s documentation and would love your feedback. Please email us &body=%0A%20%20%20%200.%20Document:%20reference/pip_freeze.%20Page%20URL:%20https:/%20%0A%0A%20%20%20%201.%20What%20problem%20were%20you%20trying%20to%20solve%20when%20you%20came%20to%20this%20page?%20%0A%0A%20%20%20%202.%20What%20content%20was%20useful?%20%0A%0A%20%20%20%203.%20What%20content%20was%20not%20useful?) and let us know:

  1. What problem were you trying to solve when you came to this page?

  2. What content was useful?

  3. What content was not useful?