requirements.txt depending on python version

前端 未结 2 415
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-04 18:38

I\'m trying to port a python2 package to python3 (not my own) using six so that it\'s compatible with both. However one of the packages listed in requirements.txt is now in

2条回答
  •  有刺的猬
    2020-12-04 19:32

    You can create multiple requirements files, put those common packages in a common file, and include them in another pip requirements file with -r file_path

    requirements/
      base.txt
      python2.txt
      python3.txt
    

    python2.txt:

    -r base.txt
    Django==1.4 #python2 only packages
    

    python3.txt:

    -r base.txt
    Django==1.5 #python3 only packages
    

    pip install -r requirements/python2.txt

提交回复
热议问题