项目概述
A set of tools to keep your pinned Python dependencies fresh.
项目地址
https://github.com/jazzband/pip-tools
项目页面预览

关键指标
- Stars:7985
- 主要语言:Python
- License:BSD 3-Clause “New” or “Revised” License
- 最近更新:2026-01-08T06:46:41Z
- 默认分支:main
本站高速下载(国内可用)
点击下载(本站镜像)
– SHA256:744ae97b8fa9d8be32cadf05fe45c792820569a7e13b751274d984e9998612a7
安装部署要点(README 精选)
Installation
Similar to pip, pip-tools must be installed in each of your project’s
virtual environments:
$ source /path/to/venv/bin/activate
(venv) $ python -m pip install pip-tools
Note: all of the remaining example commands assume you’ve activated your
project’s virtual environment.
Example usage for pip-compile
The pip-compile command lets you compile a requirements.txt file from
your dependencies, specified in either pyproject.toml, setup.cfg,
setup.py, or requirements.in.
Run it with pip-compile or python -m piptools compile (or
pipx run --spec pip-tools pip-compile if pipx was installed with the
appropriate Python version). If you use multiple Python versions, you can also
run py -X.Y -m piptools compile on Windows and pythonX.Y -m piptools compile
on other systems.
pip-compile should be run from the same virtual environment as your
project so conditional dependencies that require a specific Python version,
or other environment markers, resolve relative to your project’s
environment.
Note: If pip-compile finds an existing requirements.txt file that
fulfils the dependencies then no changes will be made, even if updates are
available. To compile from scratch, first delete the existing
requirements.txt file, or see
Updating requirements
for alternative approaches.
Requirements from setup.py and setup.cfg
pip-compile has also full support for setup.py– and
setup.cfg-based projects that use setuptools.
Just define your dependencies and extras as usual and run
pip-compile as above.
Configuration
You can define project-level defaults for pip-compile and pip-sync by
writing them to a configuration file in the same directory as your requirements
input files (or the current working directory if piping input from stdin).
By default, both pip-compile and pip-sync will look first
for a .pip-tools.toml file and then in your pyproject.toml. You can
also specify an alternate TOML configuration file with the --config option.
It is possible to specify configuration values both globally and command-specific.
For example, to by default generate pip hashes in the resulting
requirements file output, you can specify in a configuration file:
[tool.pip-tools]
generate-hashes = true
Options to pip-compile and pip-sync that may be used more than once
must be defined as lists in a configuration file, even if they only have one
value.
pip-tools supports default values for all valid command-line flags
of its subcommands. Configuration keys may contain underscores instead of dashes,
so the above could also be specified in this format:
[tool.pip-tools]
generate_hashes = true
Configuration defaults specific to pip-compile and pip-sync can be put beneath
separate sections. For example, to by default perform a dry-run with pip-compile:
[tool.pip-tools.compile] # "sync" for pip-sync
dry-run = true
This does not affect the pip-sync command, which also has a --dry-run option.
Note that local settings take preference over the global ones of the same name,
whenever both are declared, thus this would also make pip-compile generate hashes,
but discard the global dry-run setting:
[tool.pip-tools]
generate-hashes = true
dry-run = true
[tool.pip-tools.compile]
dry-run = false
You might be wrapping the pip-compile command in another script. To avoid
confusing consumers of your custom script you can override the update command
generated at the top of requirements files by setting the
CUSTOM_COMPILE_COMMAND environment variable.
$ CUSTOM_COMPILE_COMMAND="./pipcompilewrapper" pip-compile requirements.in
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# ./pipcompilewrapper
#
asgiref==3.6.0
# via django
django==4.1.7
# via -r requirements.in
sqlparse==0.4.3
# via django
常用命令(从 README 提取)
# requirements.in
django
# requirements.in
django<2.2
# dev-requirements.in
-c requirements.txt
django-debug-toolbar<2.2
通用部署说明
- 下载源码并阅读 README
- 安装依赖(pip/npm/yarn 等)
- 配置环境变量(API Key、模型路径、数据库等)
- 启动服务并测试访问
- 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)
免责声明与版权说明
本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。


![[实战教程]用aapanel或者宝塔搭建Discourse论坛-源码站](https://www.yuanmazhan.net/wp-content/uploads/2026/01/QQ20260114-145425-800x552.png)





暂无评论内容