Python相当于npm或rubygems [英] Python equivalent of npm or rubygems
问题描述
我一直在寻找可用于python的包管理器。我想列出文件中的项目依赖关系。例如,ruby使用Gemfile,你可以使用bundle install。
如何在python中实现这个功能?
工具正在成为相当于Ruby的宝石的标准。像 distribute
, pip
使用 PyPI 软件包存储库(默认情况下)用于解析和下载依赖关系。 pip
可以从列出项目依赖项的文件安装依赖项(按照惯例称为 requirements.txt
):
pip install -r requirements.txt
您可以使用pip冻结Python路径上的当前包:
pip freeze> requirements.txt
结合 virtualenv
包,您可以使用项目所需的依赖关系可靠地创建项目Python环境。
I've been looking around for a package manager that can be used with python. I want to list project dependencies in a file. For example ruby uses Gemfile where you can use bundle install. How can I achieve this in python?
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
You can "freeze" the current packages on the Python path using pip as well:
pip freeze > requirements.txt
When used in combination with the virtualenv
package, you can reliably create project Python environments with a project's required dependencies.
这篇关于Python相当于npm或rubygems的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!