Linux command
pip-freeze 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
List installed packages
pip freeze
Output to requirements file
pip freeze > requirements.txt
Include all packages including pip and setuptools
pip freeze --all
Exclude editable packages
pip freeze --exclude-editable
Exclude specific packages
pip freeze --exclude [package]
Only list packages in the current virtualenv
pip freeze --local
说明
pip freeze outputs installed packages in requirements format. Each package is shown with its exact version (package==version). This is the standard method for capturing Python environment dependencies for reproducibility. By default, pip, setuptools, wheel, and distribute are excluded from the output; use --all to include them. Packages are listed in case-insensitive sorted order.
参数
- -r, --requirement _file_
- Use requirements file order.
- -l, --local
- Only show virtualenv packages.
- --user
- Only show user packages.
- --exclude _package_
- Exclude package from output.
- --all
- Include all packages, even pip and setuptools that are normally excluded.
- --exclude-editable
- Exclude editable packages.
- --path _directory_
- Restrict to the specified installation path for listing packages.
- -q, --quiet
- Decrease output verbosity.
FAQ
What is the pip-freeze command used for?
pip freeze outputs installed packages in requirements format. Each package is shown with its exact version (package==version). This is the standard method for capturing Python environment dependencies for reproducibility. By default, pip, setuptools, wheel, and distribute are excluded from the output; use --all to include them. Packages are listed in case-insensitive sorted order.
How do I run a basic pip-freeze example?
Run `pip freeze` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r, --requirement _file_ do in pip-freeze?
Use requirements file order.