从requirements.txt按顺序安装pip

时间:2014-09-25 19:02:18

标签: python pip statsmodels egg

我想安装statemodel,所以我正在运行

sudo pip install --upgrade -r /srv/requirements.txt

包含requirements.txt

cat requirements.txt
numpy==1.9.0
scipy==0.14.0
patsy==0.3.0
pandas==0.13.0
statsmodels==0.5.0

但看起来pip并没有按顺序安装requirements.txt中列出的软件包 因为我得到依赖性错误,如“statsmodels required scipy”

有没有办法让pip按照他们在requirements.txt中列出的顺序安装软件包?

2 个答案:

答案 0 :(得分:3)

您可以使用pip模块

进行安装
import pip
with open("requirements.txt") as f:
    for line in f:
        # call pip's main function with each requirement
        pip.main(['install','-U', line])

答案 1 :(得分:0)

cat /srv/requeriments.txt | xargs pip install --upgrade -r