Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python equivalent of npm or rubygems

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?

like image 566
Dillon Benson Avatar asked Nov 24 '12 03:11

Dillon Benson


People also ask

What is npm for Python?

npm is the command-line interface to the npm ecosystem. It is battle-tested, surprisingly flexible, and used by hundreds of thousands of JavaScript developers every day. On the other hand, pip is detailed as "A package installer for Python". It is the package installer for Python.

Does npm work with Python?

It is possible to specify a python version when npm installing npm install --python=python2. 7 . We can also configure npm to use a specific version of python (stackoverflow).

What is package JSON in Python?

A package. json is a JSON file that exists at the root of a Javascript/Node project. It holds metadata relevant to the project and it is used for managing the project's dependencies, scripts, version and a whole lot more.

What is Npmjs?

2011-08-26. npm is two things: first and foremost, it is an online repository for the publishing of open-source Node. js projects; second, it is a command-line utility for interacting with said repository that aids in package installation, version management, and dependency management.


1 Answers

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.

like image 52
Barry Wark Avatar answered Sep 22 '22 18:09

Barry Wark