栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

使用conda从requirements.txt中安装依赖包

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用conda从requirements.txt中安装依赖包

直接使用conda进行安装
conda install --yes --file requirements.txt

这样的安装方式,如果requirements.txt中的包不可用,则会抛出“无包错误”。解决方法:

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

但是这样的方法也不完美,如果有包不可用时,则没有安装完全。

conda和pip混合使用

使用这个方法,将会优先使用conda安装,如果conda中没有对应的包,则使用pip安装

\ Linux
while read requirement; do conda install --yes $requirement; done < requirements.txt
\ Windows
FOR /F "delims=~" %f in (requirements.txt) DO conda install --yes "%f" || pip install "%f"

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/269120.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号