【问题标题】:Conda: specify environment variable before creating env from YAML fileConda:在从 YAML 文件创建 env 之前指定环境变量
【发布时间】:2018-09-16 10:12:35
【问题描述】:

我正在创建一个environment.yml 文件以创建自定义环境。

其中一个包(我通过pip 安装)需要设置一个环境变量(即MACOSX_DEPLOYMENT_TARGET=10.7 以使gcc 开心)。

我该怎么做?

name: mypy27
channels:
  # Default distribution from Continuum/Anaconda
  - defaults
  # Conda forge distribution
  # https://conda-forge.org
  - conda-forge
dependencies:
  - python=2.7
  - anaconda
  - pip:
    - rootnumpy
    - git+https://mypackage.git#egg=mypackage

关键是在启动rootnumpy安装之前设置环境变量。

【问题讨论】:

标签: python conda


【解决方案1】:

从 Conda v4.9 开始,您可以在“environment.yml”文件中定义环境变量:

name: foo
channels:
  - defaults
dependencies:
  - python
variables:
  MY_VAR: something
  OTHER_VAR: ohhhhya

请参阅the documentationthis answer 了解更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-03
    • 2017-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-16
    相关资源
    最近更新 更多