繁体   English   中英

pip 安装额外索引 url 到 requirements.txt

[英]pip install with extra index url to requirements.txt

我有以下 package 的安装命令:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

并且需要将其添加到我的 requirements.txt 文件中。 我通过将其添加到文件末尾来完成它:

-i https://download.pytorch.org/whl/cu116
torch
torchvision 
torchaudio

毕竟其他要求。 我现在没有办法测试它,并且需要知道我是否正确地完成了它,因为我以前从未做过。

这是将其添加到 requirements.txt 文件的正确方法吗?

如果是,在这些之后添加其他包,例如numpy,它会受到url的影响吗? 我是否必须对 url 进行排序,还是只是将其添加到它搜索的 url 列表中?

任何帮助表示赞赏

找到解决方案,您使用的命令和requirements.txt文件实际上并不相同。 它适用于这样的requirements.txt

--extra-index-url https://download.pytorch.org/whl/cu116
torch
torchvision 
torchaudio

原来-i--extra-index-url

文档: https://pip.pypa.io/en/stable/reference/requirements-file-format/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM