A single command in python to install the appropriate modules from the package.json file

In node.js, during deployment, you can run npm update --production , and all relevant node.js modules are installed until the correct package.json package is installed.

Is there a command line equivalent for command line for python? Can pip do the same as npm?

+7
python pip
source share
3 answers

yes there is a command for this, as soon as you want to deploy, you can generate the package file using the following command:

 pip freeze > requirements.txt 

and whenever you want to install packages from the same file, use:

 pip install -r requirements.txt 

you can find more information about freeze here

+10
source share

You can do

 pip freeze > requirements.txt 

In the local machine. And on the server

 pip install -r requirements.txt 

This installs all the dependencies.

+2
source share

Yes, you can put your packages in a simple text file requirements.txt , for example. (version numbers are optional)

 SQLAlchemy==1.0.4 requests==2.4.3 

and then do pip install -r requirements.txt

+1
source share

All Articles