简体   繁体   English

如何在 environment.yml 中指定 pip --extra-index-url?

[英]How to specify pip --extra-index-url in environment.yml?

Conda can create an environment.yml that specifies both conda packages & pip packages. Conda 可以创建一个environment.yml来指定 conda 包和 pip 包。 The problem is, I want to specify a pip package ( torch==1.12.1+cu116 ), that is only available in the following index: https://download.pytorch.org/whl/cu116 . The problem is, I want to specify a pip package ( torch==1.12.1+cu116 ), that is only available in the following index: https://download.pytorch.org/whl/cu116 .

How can I specify this in the environment.yml?如何在 environment.yml 中指定它? Or at the very least, when running conda env create -f environment.yml , I would like to specify the extra index for pip.或者至少,在运行conda env create -f environment.yml时,我想为 pip 指定额外的索引。

This configuration should work, see the advanced-pip-example for other options.此配置应该可以工作,其他选项请参见advanced-pip-example

name: foo
channels:
  - defaults
dependencies:
  - python
  - pip
  - pip:
    - --extra-index-url https://download.pytorch.org/whl/cu116
    - torch==1.12.1+cu116

See also也可以看看

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

相关问题 如何验证pip的--extra-index-url? - How to validate pip's --extra-index-url? How to specify authentication for Pip Project setup pip with extra-index-url in pip.ini (Windows) or pip.conf (Mac/Linux) on azure pipelines/artifacts - How to specify authentication for Pip Project setup pip with extra-index-url in pip.ini (Windows) or pip.conf (Mac/Linux) on azure pipelines/artifacts 升级到 18.1 后无法将 --extra-index-url 与 pip 一起使用 - Unable to use --extra-index-url with pip after upgrading to 18.1 我如何在 pip.conf 中声明多个 extra-index-url - How do i declare more than one extra-index-url in pip.conf 如何将.condarc 中提供的代理用于environment.yml 中的pip 包? - How to use the proxy provided in .condarc for pip packages in the environment.yml? 如何在 environment.yml 文件中指定 Python 版本范围? - How to specify Python version range in environment.yml file? 如何在Conda environment.yml中指定版本范围 - How to specify version ranges in Conda environment.yml python pip 具有 index-url 和 extra-index-url 的优先顺序 - python pip priority order with index-url and extra-index-url 将pip与两个都指向同一个域的--extra-index-url参数一起使用 - Using pip with two --extra-index-url arguments that both point to the same domain python2; 使用--trusted-host和--extra-index-url pip parse_requirements - python2; pip parse_requirements with --trusted-host and --extra-index-url
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM