更新时间:2022-04-01 05:11:06
pip
工具正在成为 Ruby gems 等价物的标准.与 distribute
一样,pip
使用 PyPI 包存储库(默认情况下)用于解析和下载依赖项.pip
可以从列出项目依赖项的文件(按照惯例称为 requirements.txt
)安装依赖项:
The pip
tool is becoming the standard in equivalent of Ruby's gems. Like distribute
, pip
uses the PyPI package repository (by default) for resolving and downloading dependencies. pip
can install dependencies from a file listing project dependencies (called requirements.txt
by convention):
pip install -r requirements.txt
您也可以使用 pip 冻结" Python 路径上的当前包:
You can "freeze" the current packages on the Python path using pip as well:
pip freeze > requirements.txt
与 virtualenv
包结合使用时,您可以使用项目所需的依赖项可靠地创建项目 Python 环境.
When used in combination with the virtualenv
package, you can reliably create project Python environments with a project's required dependencies.