Steven's Blog

A Dream Land of Peace!

Python从多个requirements文件安装包

Say we want to install modules from multiple requirement files. We will put the requirement files in the directory “requirements”.

First the base.txt file.

1
2
Django==1.7.10
psycopg2==2.4.5

Then the file local.txt

1
2
-r base.txt
django-discover-runner==0.2.2

and production.txt(production installaions should be close to what is used in other locations, so production.txt commonly just calls base.txt)

1
-r base.txt

The for local and production env, we can issue the following commands:

1
pip install -r requirements/local.txt
1
pip install -r requirements/production.txt