Install only available packages using “conda install --yes --file requirements.txt” without error

前端 未结 4 607
庸人自扰
庸人自扰 2020-12-12 10:23

While installing packages in requirements.txt using Conda through the following command

conda install --yes --file requirements.txt

If a pack

4条回答
  •  萌比男神i
    2020-12-12 10:47

    I ended up just iterating over the lines of the file

    $ while read requirement; do conda install --yes $requirement; done < requirements.txt

    Edit: If you would like to install a package using pip if it is not available through conda, give this a go:

    $ while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt

    Edit: If you are using Windows (credit goes to @Clay):

    $ FOR /F "delims=~" %f in (requirements.txt) DO conda install --yes "%f" || pip install "%f"

提交回复
热议问题