2024-09-01
工具使用
00

目录

导出项目的所有依赖库
安装项目的所有依赖库
conda批量导出包含环境中所有组件的requirements.txt文件
conda批量安装requirements.txt文件中包含的组件依赖
Error: No packages found in current
PackagesNotFoundError: The following packages are not available from current channels:

导出项目的所有依赖库

c
pip3 freeze > requirements.txt

安装项目的所有依赖库

c
pip install -r requirements.txt

conda批量导出包含环境中所有组件的requirements.txt文件

c
conda list -e > requirements.txt

conda批量安装requirements.txt文件中包含的组件依赖

c
conda install --yes --file requirements.txt

Error: No packages found in current

PackagesNotFoundError: The following packages are not available from current channels:

参考:https://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t

linux 遍历执行安装

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

linux遍历执行安装,conda不行pip试试的指令:

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

windows遍历执行安装,conda不行pip试试的指令:

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

wondows遍历安装

c
FOR /F "delims=~" %f in (requirements.txt) DO conda install --yes "%f"
如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:Dong

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!