pip - 如何在 conda 环境文件中指定 pip find-links 选项?
问题描述
我有一个 pip 要求文件,其中包含特定的纯 cpu 版本的 torch 和 torchvision。我可以使用以下 pip 命令成功安装我的要求。
pip install --requirement azure-pipelines-requirements.txt --find-links https://download.pytorch.org/whl/torch_stable.html
我的需求文件看起来像这样
coverage
dataclasses
joblib
matplotlib
mypy
numpy
pandas
param
pylint
pyro-ppl==1.2.1
pyyaml
scikit-learn
scipy
seaborn
torch==1.4.0+cpu
torchvision==0.5.0+cpu
visdom
这适用于 bash,但是如何find-links
使用 conda 环境 yaml 文件中的选项调用 pip?我目前的尝试看起来像这样
name: build
dependencies:
- python=3.6
- pip
- pip:
- --requirement azure-pipelines-requirements.txt --find-links https://download.pytorch.org/whl/torch_stable.html
但是当我调用
conda env create --file azure-pipeline-environment.yml
我得到这个错误。
Pip 子进程错误:
错误:找不到满足要求的版本 torch==1.4.0+cpu(来自 -r E:\Users\tim\Source\Talia\azure-pipelines-requirements.txt(第 25 行)) (来自版本:0.1.2、0.1.2.post1、0.1.2.post2)
错误:找不到匹配的分布 fortorch==1.4.0+cpu(来自 -r E:\Users\tim\Source\Talia\ azure-pipelines-requirements.txt(第 25 行))CondaEnvException:Pip 失败
find-links
从 conda 环境 yaml 文件调用 pip 时如何指定选项?
解决方案
此示例显示如何为 pip 指定选项
首先指定全局 pip 选项:
name: build
dependencies:
- python=3.6
- pip
- pip:
- --find-links https://download.pytorch.org/whl/torch_stable.html
- --requirement azure-pipelines-requirements.txt
推荐阅读
- mahapps.metro - MetroApps 未找到 ResourceDictionary 2.0.0-alpha0748
- reactjs - React 测试库的 waitFor() 返回 null
- c# - 如何处理在 C# 中加载时显示为串联字符串的 Crystal Report 记录选择公式?
- reactjs - 父元素的排队 React 更新是否也总是更新子元素?
- python - 使用 .loc 覆盖值
- angular - 使用变量 angular2 路由?
- python - 如何规范化 [0,1] 范围内的数据框中的数据?
- c# - MailKit 的 IMessageSummary.Envelope.InReplyTo 字段始终为空
- python - 使用 lxml 添加具有不同于根元素的命名空间的 xml 子元素
- database-replication - 数据库复制失败并出现“进程无法执行'sp_MSadd_replcmds'”错误